Skip to content

Instantly share code, notes, and snippets.

@andromedarabbit
Created March 3, 2017 15:44
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save andromedarabbit/4bcd790f2eca7bca6ddf54c7b49e5f35 to your computer and use it in GitHub Desktop.
Save andromedarabbit/4bcd790f2eca7bca6ddf54c7b49e5f35 to your computer and use it in GitHub Desktop.
ElastAlert rule example
# Alert when the rate of events exceeds a threshold
# (Required)
# Rule name, must be unique
name: OutOfMemoryError
# (Required)
# Type of alert.
# the frequency rule type alerts when num_events events occur with timeframe time
type: frequency
# (Required)
# Index to search, wildcard supported
index: logstash-%Y.%m.%d*
use_strftime_index: true
# (Required, frequency specific)
# Alert when this many documents matching the query occur within a timeframe
num_events: 1
# (Required, frequency specific)
# num_events must occur within this amount of time to trigger an alert
timeframe:
hours: 1
# (Required)
# A list of Elasticsearch filters used for find events
# These filters are joined with AND and nested in a filtered query
# For more info: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl.html
filter:
- query_string:
query: "message: OutOfMemoryError OR log: OutOfMemoryError"
# (Required)
# The alert is use when a match is found
alert:
- "slack"
@samratbe
Copy link

how can i set rule when a particular string is not present in logs.

LIke i want to get alert when a string "12345678" is not in logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment