使用apache_log数据的logstash geoip解析失败

lo8azlld  于 2023-03-11  发布在  Logstash
关注(0)|答案(1)|浏览(199)

我是新来的elasticsearch。
我想使用apache_logs数据来使用logstash中的geoip过滤器。
Apache日志数据:
"83.149.9.216 - - [17/May/2015:10:05:03 +0000] \"GET /presentations/logstash-monitorama-2013/images/kibana-search.png HTTP/1.1\" 200 203023 \"http://semicomplete.com/presentations/logstash-monitorama-2013/\" \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36\""
logstash.conf

input {
        tcp {
            port => 9900
        }
    }

    filter {
        grok {
            match => { "message" => "%{IP:clientip}" }
        }

        geoip {
            source => "clientip"
        }
    }

    output {
        stdout { }
    }

我得到了下面的错误..

Pipeline error {:pipeline_id=>"main", :exception=>#<LogStash::ConfigurationError: GeoIP Filter in ECS-Compatiblity mode requires a `target` when `source` is not an `ip` sub-field, eg. [client][ip]> 
....
Failed to execute action {:id=>:main, :action_type=>LogStash::ConvergeResult::FailedAction, :message=>"Could not execute action: PipelineAction::Reload<main>, action_result: false", :backtrace=>nil}

下面是我数据输出:

{
    "@timestamp" => 2022-03-09T09:40:28.652491Z,
      "clientip" => "83.149.9.216",
      "@version" => "1",
       "message" => "83.149.9.216 - - [17/May/2015:10:05:03 +0000] \"GET /presentations/logstash-monitorama-2013/images/kibana-search.png HTTP/1.1\" 200 203023 \"http://semicomplete.com/presentations/logstash-monitorama-2013/\" \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36\"",
         "event" => {
        "original" => "83.149.9.216 - - [17/May/2015:10:05:03 +0000] \"GET /presentations/logstash-monitorama-2013/images/kibana-search.png HTTP/1.1\" 200 203023 \"http://semicomplete.com/presentations/logstash-monitorama-2013/\" \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36\""
    }
}

你们能帮我解决这个问题吗?谢谢。

0wi1tuuw

0wi1tuuw1#

我像bewlow一样更改配置:

geoip {
    source => "[ip]"
    ecs_compatibility => disabled
}

希望这能有所帮助

相关问题