Skip to content

Adding additional fields to ElastAlert documents. #1441

Closed Locked Answered by jertel
jeff-bb asked this question in Q&A
Discussion options

You must be logged in to vote

I see. You can add an enhancement to grab those params out of the rule dict, and push them into the match dictionary. That match dictionary is what lands inside the match_body.* fields, stored in the elastalert index.

Ex:

My Rule:

type: frequency

foo: bar

index: logs-*
name: foo

num_events: 10
timeframe:
  minutes: 5

filter:
- query_string:
    analyze_wildcard: true
    query: 'level: (ERROR OR WARN) AND NOT message: ("test msg" OR "testing rule")'

alert:
  - debug

match_enhancements:
- "mod.test.MyEnhancement"

My Custom Enhancement, placed in a new file mod/test.py

from elastalert.enhancements import BaseEnhancement

class MyEnhancement(BaseEnhancement):
    def process(self, mat…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@jeff-bb
Comment options

@jertel
Comment options

Answer selected by jeff-bb
@jeff-bb
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants