ELK分析IIS日志
LogStash.conf
input { file { type => "iis_log" path => ["C:/inetpub/logs/LogFiles/W3SVC2/u_ex*.log"] } } filter { #ignore log comments if [message] =~ "^#" { drop {} } grok { # check that fields match your IIS log settings match => ["message", "%{TIMESTAMP_ISO8601:log_timestamp} (%{IPORHOST:s-ip}|-) (%{WORD:cs-method}|-) %{NOTSPACE:cs-uri-stem} %{NOTSPACE:cs-uri-query} (%{NUMBER:s-port}|-) (%{NOTSPACE:c-username}|-) (%{IPORHOST:c-ip}|-) %{NOTSPACE:cs-useragent} (%{NUMBER:sc-status}|-) (%{NUMBER:sc-win32-status}|-) (%{NUMBER:time-taken}|-)"] } #Set the Event Timesteamp from the log date { match => [ "log_timestamp", "YYYY-MM-dd HH:mm:ss" ] timezone => "Etc/UCT" } mutate { remove_field => [ "log_timestamp"] convert => [ "sc-bytes", "float" ] convert => [ "cs-bytes", "float" ] convert => [ "time-taken", "float" ] } mutate { remove_field => [ "log_timestamp"] convert => [ "sc-bytes", "float" ] convert => [ "cs-bytes", "float" ] convert => [ "time-taken", "float" ] } } output { stdout {codec => rubydebug } elasticsearch { hosts => ["localhost:9200"] index => "logstash-%{type}-%{+YYYY.MM.dd}" flush_size => 20000 idle_flush_time => 10 template_overwrite => true } redis { host => '127.0.0.1' data_type => 'list' key => 'logstash:redis' } }
作者:旭东
出处:http://www.cnblogs.com/HQFZ
关于作者:专注于微软平台项目架构、管理和企业解决方案。现主要从事WinForm、ASP.NET、WPF、WCF、等方面的项目开发、架构、管理。如有问题或建议,请不吝指教!
本文版权归作者,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接。如有问题,可以联系我,非常感谢。
如果您该文觉得不错或者对你有帮助,请点下推荐,让更多的朋友看到,谢谢!