Quantcast
Channel: Serverphorums.com - HAProxy
Viewing all articles
Browse latest Browse all 5112

haproxy email alert subject length exceeds 78 chars (no replies)

$
0
0
Hello All,

We have had a customer complain about the subject length of the new email
alerts system in haproxy-1.7-dev quoting RFC 2822 rule on headers:

"There are two limits that this standard places on the number of characters
in a line. Each line of characters MUST be no more than 998 characters, and
SHOULD be no more than 78 characters, excluding the CRLF"

I have created a patch to split the msg and create a new 'msgsubject' and
would like to hear what other people think of my suggestion here. I know
the RFC 2822 is now very old and possibly outdated but may still be valid.

My subject now shows as

"[HAproxy Alert] Server VIP/RIP is DOWN"

leaving the message intact in the email body

"Server VIP/RIP is DOWN, reason: Layer7 invalid response, info: "HTTP
content check did not match", check duration: 31ms. 0 active and 1 backup
servers left. Running on backup. 0 sessions active, 0 requeued, 0 remaining
in queue"

Appologies for the code being overly simple, my C is not great and I could
not figure how the "msg" is formed but below is a patch for src/checks.c
what do you think?


--- checks.c.orig 2016-01-11 10:41:33.383022756 +0000
+++ checks.c 2016-01-11 11:48:00.103057302 +0000
@@ -3247,12 +3247,14 @@

{
struct tm tm;
+ char *msgdup = strdup(msg); /* Create a duplicate of
'msg' */
+ char *msgsubject = strtok(msgdup, ","); /* I sould not figure out
how the message was formed so I just split my msgdup at , */
char datestr[48];
const char * const strs[18] = {
"From: ", p->email_alert.from, "\n",
"To: ", p->email_alert.to, "\n",
"Date: ", datestr, "\n",
- "Subject: [HAproxy Alert] ", msg, "\n",
+ "Subject: [HAproxy Alert] ", msgsubject, "\n", /* replace msg
with msgsubject so the subject length is in keeping with RFC 2822 */
"\n",
msg, "\n",
"\r\n",



Regards

Andrew Smalley

Loadbalancer.org
http://www.loadbalancer.org

Viewing all articles
Browse latest Browse all 5112

Trending Articles