Alert Static Payload #381
-
I'm looking for a way to add static fields for all of my ElastAlert alerts. Perhaps something similar to This would be useful in my scenario. Where I have multiple deployments of ElastAlert, each having some static values to distinguish it from other deployments. Example name: First ElastAlert
type: # Doesn't matter (?)
index: alex_index-*
filter:
- query:
query_string:
query: "yes"
# Add static payload to all matches
static_payload:
my_extra_key: value
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 7 replies
-
I don't think there is a way to add a static field to every ElastAlert2 alert. For example, in the case of Twilio, it's just the rule name, twilio_to_number, and twilio_message_service_sid. At this point, not all alerts are possible.
|
Beta Was this translation helpful? Give feedback.
-
I'm not sure I understand exactly what you're looking to do, but depending on the alerter I think it might be possible. With this rule:
You can use the
In this case, the N.B - ElastAlert prioritises the match data over the rule data, so if you have a In addition, in some cases, as @nsano-rururu mentioned, alerters don't build their message bodies using the |
Beta Was this translation helpful? Give feedback.
-
Maybe I can find a workaround for the 4 alerts that I use? dummy:
k: v
alert_text: |
{{ dummy["k"] }} |
Beta Was this translation helpful? Give feedback.
-
I see it's also possible to use custom python class to modify matches as "enhancements" |
Beta Was this translation helpful? Give feedback.
I'm not sure I understand exactly what you're looking to do, but depending on the alerter I think it might be possible.
With this rule:
You can use the
alert_text
andalert_text_args
arguments like so to get thestatic_payload
value:In this case, the
alert_text
would bepayload: test
if the alerter builds its message body using the built-in ElastAlert functionality - most of the alerters do. I think this is what you are looking for?N.B - ElastAl…