阅读169 返回首页    go 阿里云


Logstash收集IIS日志__常见日志格式_用户指南_日志服务-阿里云

查看IIS日志配置,选择格式为W3C(默认字段设置)保存生效。

  1. 2016-02-25 01:27:04 112.74.74.124 GET /goods/list/0/1.html - 80 - 66.249.65.102 Mozilla/5.0+(compatible;+Googlebot/2.1;++https://www.google.com/bot.html) 404 0 2 703

采集配置

  1. input {
  2. file {
  3. type => "iis_log_1"
  4. path => ["C:/inetpub/logs/LogFiles/W3SVC1/*.log"]
  5. start_position => "beginning"
  6. }
  7. }
  8. filter {
  9. if [type] == "iis_log_1" {
  10. #ignore log comments
  11. if [message] =~ "^#" {
  12. drop {}
  13. }
  14. grok {
  15. # check that fields match your IIS log settings
  16. match => ["message", "%{TIMESTAMP_ISO8601:log_timestamp} %{IPORHOST:site} %{WORD:method} %{URIPATH:page} %{NOTSPACE:querystring} %{NUMBER:port} %{NOTSPACE:username} %{IPORHOST:clienthost} %{NOTSPACE:useragent} %{NUMBER:response} %{NUMBER:subresponse} %{NUMBER:scstatus} %{NUMBER:time_taken}"]
  17. }
  18. date {
  19. match => [ "log_timestamp", "YYYY-MM-dd HH:mm:ss" ]
  20. timezone => "Etc/UTC"
  21. }
  22. useragent {
  23. source=> "useragent"
  24. prefix=> "browser"
  25. }
  26. mutate {
  27. remove_field => [ "log_timestamp"]
  28. }
  29. }
  30. }
  31. output {
  32. if [type] == "iis_log_1" {
  33. logservice {
  34. codec => "json"
  35. endpoint => "***"
  36. project => "***"
  37. logstore => "***"
  38. topic => ""
  39. source => ""
  40. access_key_id => "***"
  41. access_key_secret => "***"
  42. max_send_retry => 10
  43. }
  44. }
  45. }
  1. 配置文件格式必须以UTF-8无BOM格式编码,可以下载notepad++修改文件编码格式。
  2. path填写文件路径时请使用UNIX模式的分隔符,如:C:/test/multiline/*.log,否则无法支持模糊匹配。
  3. type字段需要统一修改并在该文件内保持一致,如果单台机器存在多个logstash配置文件,需要保证各配置type字段唯一,否则会导致数据处理的错乱。

相关插件:filegrok

重启Logstash生效

创建配置文件到conf目录,参考通过Logstash收集Windows平台日志重启Logstash生效。

最后更新:2016-11-24 11:23:47

  上一篇:go wordpress日志__常见日志格式_用户指南_日志服务-阿里云
  下一篇:go Logstash收集csv日志__常见日志格式_用户指南_日志服务-阿里云