Skip to content

Instantly share code, notes, and snippets.

@sjmach
Last active April 1, 2017 16:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sjmach/81514d24ec7aee4627a30888209a4352 to your computer and use it in GitHub Desktop.
Save sjmach/81514d24ec7aee4627a30888209a4352 to your computer and use it in GitHub Desktop.
Logstash config file
input {
stdin {
type => "stdin-type"
}
file {
#Replace the path
path => ["XXXXXXXXX/logging.log"]
# Make logstash read from start of file
start_position => "beginning"
sincedb_path => "/dev/null"
}
}
filter {
csv {
#CSV fields that we want mapped to an Index
columns => ["logdate","Url","Code","Result"]
separator => ","
}
date {
# Match the Date format
match => ["logdate","yyyy-MM-dd;HH:mm:ss:SSSZ"]
timezone => "Asia/Kolkata"
target => "@timestamp"
}
}
output {
elasticsearch { hosts => localhost}
if "FAIL" in [message] {
email {
port => "587"
address => "smtp.gmail.com"
username => "XXXXXXXXX"
password => "XXXXXXXXX"
authentication => "plain"
use_tls => true
from => "XXXXXXXXX"
subject => "Stream down alert : %{message} "
to => "XXXXXXXXX"
cc => "XXXXXXXXX"
via => "smtp"
body => "The stream that failed: %{message}"
}
}
stdout { codec => rubydebug }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment