Skip to content

Instantly share code, notes, and snippets.

@arunk-s
Created July 9, 2014 16:13
Show Gist options
  • Save arunk-s/7caed1d33c255b8503f6 to your computer and use it in GitHub Desktop.
Save arunk-s/7caed1d33c255b8503f6 to your computer and use it in GitHub Desktop.
Hekad configuration file for anamoly detection from nginx logs
[hekad]
maxprocs = 4
# Nginx access log reader
[Nginxserver]
type = "LogstreamerInput"
log_directory = "/var/log/nginx"
file_match = 'access\.log'
decoder = "CombinedNginxDecoder"
# Nginx access 'combined' log parser
[CombinedNginxDecoder]
type = "SandboxDecoder"
filename = "lua_decoders/nginx_access.lua"
[CombinedNginxDecoder.config]
user_agent_transform = true
user_agent_conditional = true
type = "combined"
log_format = '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"'
# Nginx error log reader
[NginxserverError]
type = "LogstreamerInput"
log_directory = "/var/log/nginx"
file_match = 'error\.log'
decoder = "NginxErrorDecoder"
[NginxErrorDecoder]
type = "SandboxDecoder"
filename = "lua_decoders/nginx_error.lua"
[NginxErrorDecoder.config]
tz = "America/Los_Angeles"
[ErrorAlert]
type = "SmtpOutput"
message_matcher = "((Type == 'heka.sandbox-output' && Fields[payload_type] == 'alert') || Type == 'heka.sandbox-terminated') && Logger =~ /^Nginx/ "
send_from = "[email protected]"
send_to = ["[email protected]"]
auth = "Plain"
user = "test"
password = "testpw"
host = "localhost:25"
encoder = "AlertEncoder"
[AlertEncoder]
type = "SandboxEncoder"
filename = "lua_encoders/alert.lua"
# Does it need a httpstatus filter
# What could be More output options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment