elastalert icon indicating copy to clipboard operation
elastalert copied to clipboard

alert_text doesn't work when sending alert to a POST server

Open q2dg opened this issue 7 years ago • 4 comments

Hello. I've this rule:

 name: MyRule
 type: any
 index: logstash-*
 filter: []
 alert:
 - post
 http_post_url: "http://ptsv2.com/t/lalala/post"
 alert_text: "Timestamp: {0} ; Message: {1}"
 alert_text_type: alert_text_only
 alert_text_args: ["@timestamp","message"]

Alerts are received by post server correctly (in fact, this server is public, so you can see the content of the received message if you go to http://ptsv2.com/t/lalala) BUT alert_text+alert_text_type+alert_text_args options are completely ignored: received message on server is a JSON which, moreover, I can't relate to theorical default alert's body explained here https://elastalert.readthedocs.io/en/latest/ruletypes.html#alert-content

Do you know why? Am I doing something wrong? Is it a bug?

Thanks!!!

q2dg avatar Jan 19 '19 23:01 q2dg

This is a bug (or feature 😉 ). You can't add it easily right now, but this is definitely something I want to fix.

There's some workarounds you could do. One is to create an enhancement that would create this string so you can put it into the http_post_payload. This would require writing a small amount of Python code though. If you want some help on that let me know.

Qmando avatar Jan 23 '19 02:01 Qmando

Ok, Thanks for caring about it. I'll be waiting, it's not an urgent issue for me. Thanks

q2dg avatar Jan 23 '19 08:01 q2dg

I had the same problem,and i want to know when to fix it, thanks~~ @Qmando

AlbertMeg avatar Apr 25 '19 03:04 AlbertMeg

This is a bug (or feature 😉 ). You can't add it easily right now, but this is definitely something I want to fix.

There's some workarounds you could do. One is to create an enhancement that would create this string so you can put it into the http_post_payload. This would require writing a small amount of Python code though. If you want some help on that let me know.

Hi @Qmando Do we have this feature now! in http post alerts. I have created an HTML template into the alert_text, which i want to pass into http_post_payload. Is there a way?

rashmichoudhary07 avatar May 07 '20 20:05 rashmichoudhary07