zoukankan      html  css  js  c++  java
  • logstash 收集 IIS 日志实践

    IIS日志示例:

    2017-02-20 00:55:40 127.0.0.1 GET /MkWebAPI/swagger/ui/index - 80 - 127.0.0.1 Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/49.0.2623.75+Safari/537.36 200 0 0 32
    

    collect_iis.conf

    input {
      file {
        type => "iis_log_1"
        path => ["C:/inetpub/logs/LogFiles/W3SVC1/*.log"]
        start_position => "beginning"
      }
    }
    filter {
      if [type] == "iis_log_1" {
      #ignore log comments
      if [message] =~ "^#" {
        drop {}
      }
      grok {
        # check that fields match your IIS log settings
        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}"]
      }
        date {
        match => [ "log_timestamp", "YYYY-MM-dd HH:mm:ss" ]
          timezone => "Etc/UTC"
      }    
      useragent {
        source=> "useragent"
        prefix=> "browser"
      }
      mutate {
        remove_field => [ "log_timestamp"]
      }
      }
    }
    output {
      if [type] == "iis_log_1" {
      logservice {
            codec => "json"
            endpoint => "***"
            project => "***"
            logstore => "***"
            topic => ""
            source => ""
            access_key_id => "***"
            access_key_secret => "***"
            max_send_retry => 10
        }
        }
    }
    
  • 相关阅读:
    Google ObjectiveC Style Guide
    FlvDownloader 2.2发布
    在C#中实现关机
    在.net 2.0/3.0程序中使用扩展方法
    Boost智能指针——scoped_ptr
    二叉查找树
    用C#调用ffmpeg实现媒体类型转换(1)
    FlvDownloader v2.21发布
    发布一款ICO图标和PNG批量转换工具
    在.net中创建外接程序
  • 原文地址:https://www.cnblogs.com/pengzhen/p/6930264.html
Copyright © 2011-2022 走看看