Skip to content

Instantly share code, notes, and snippets.

@shaosh
Last active December 1, 2015 23:07
Show Gist options
  • Save shaosh/79e307e3b31742b79f5b to your computer and use it in GitHub Desktop.
Save shaosh/79e307e3b31742b79f5b to your computer and use it in GitHub Desktop.
logstash.conf file to log IIS errors in ELK
#############
# Support multiple xml files
#############
input
{
file{
path => ["C:/inetpub/logs/FailedReqLogFiles/*/*.xml"]
start_position => "beginning"
# filter is not thread safe, so have to move the multiline into the input
codec => multiline{
pattern => "^<\?xml version"
negate => true
what => "previous"
max_lines => 12000
}
sincedb_path => "C:/Users/sshao/Source/elk/logstash/bin/.sincedb"
}
}
filter{
xml{
store_xml => "false"
source => "message"
target => "EVENT"
xpath => [
"/failedRequest/@url", "url",
"/failedRequest/@appPoolId", "appPoolId",
"/failedRequest/@verb", "verb",
"/failedRequest/@statusCode", "statusCode"
]
}
# Remove the long redundant message block
mutate
{
remove_field => [ "message" ]
}
}
output
{
elasticsearch{
hosts => ["192.168.0.1:9200"]
index => "testserver-logstash-%{+YYYY.MM.dd}"
}
stdout
{
codec => rubydebug
}
file{
path => "C:/Users/sshao/Source/elk/logstash/bin/test.log"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment