码迷,mamicode.com
首页 > 其他好文 > 详细

ELK分析IIS日志

时间:2017-01-04 18:51:42      阅读:406      评论:0      收藏:0      [点我收藏+]

标签:check   ast   setting   code   hosts   png   comm   arc   iso   

技术分享

 

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‘
  }
}

ELK分析IIS日志

标签:check   ast   setting   code   hosts   png   comm   arc   iso   

原文地址:http://www.cnblogs.com/HQFZ/p/6249568.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!