我通过filebeat发送Nginx日志->弹性搜索-> Kibana。但是某些日志已经有问题。
看来这种类型的日志正在解析,没有任何问题:
66.249.76.123--[24 / Apr / 2020:17:24:51 +0200]“ GET / HTTP / 1.1” 200 5249“-”“ Mozilla / 5.0(Linux; Android 6.0.1; Nexus 5X Build / MMB29P)AppleWebKit / 537.36(KHTML,例如Gecko)Chrome / 41.0.2272.96移动Safari / 537.36(兼容; Googlebot / 2.1; + http://www.google.com/bot.html)“
但另一方面类似日志:
62.197.243.55--[24 / Apr / 2020:17:29:22 +0200]“ GET / HTTP / 1.1” 200 5252“-”“ Mozilla / 5.0(Macintosh;英特尔Mac OS X 10_15_3)AppleWebKit / 537.36(KHTML,例如Gecko)Chrome / 80.0.3987.163 Safari / 537.36“
向系统日志抛出错误-
[Apr 24 17:29:31 prodserver filebeat [12562]:2020-04-24T17:29:31.497 + 0200#011WARN#011elasticsearch / client.go:517#011无法为事件发布者建立索引。事件{Content:beat.Event {时间戳记:time.Time {wall:0xbfa0df569acc421c,ext:321343689727,loc:(* time.Location)(0x5003080)},Meta:{“ pipeline”:“ filebeat-7.6.2-nginx-access-default”},字段:{“ agent”:{“ ephemeral_id”:“ 3d9ae7ae-c460-4e7b-b994-f10a681cc10b”,“主机名”:“ prodserver”,“ id”:“ 58d1eb1d-9c09-485d-ad7f-28b0066a0054”,“类型” :“ filebeat”,“ version”:“ 7.6.2”},“ ecs”:{“ version”:“ 1.4.0”},“ event”:{“ dataset”:“ nginx.access”,“ module” :“ nginx”,“时区”:“ + 02:00”},“文件集”:{“名称”:“访问”},“主机”:{“名称”:“产品服务器”},“输入”:{ “ type”:“ log”},“ log”:{“ file”:{“ path”:“ / var / log / nginx / denevy.access.log”},“ offset”:483636},“ message”: “ 62.197.243.55--[24 / Apr / 2020:17:29:22 +0200] \” GET / HTTP / 1.1 \“ 200 5252 \”-\“ \” Mozilla / 5.0(Macintosh; Intel Mac OS X 10_15_3 )AppleWebKit / 537.36(KHTML,例如Gecko)Chrome / 80.0.3987.163 Safari / 537.36 \“”,“ service”:{“ type”:“ nginx”}} ,私有:file.State {Id:“”,完成:false,Fileinfo:(* os.fileStat)(0xc0008c4d00),来源:“ / var / log / nginx / denevy.access.log”,偏移量:483837,时间戳:time.Time {wall:0xbfa0df0e51ae7c7f,ext:32190743674,loc:(* time.Location)(0x5003080)},TTL:-1,Type:“ log”,Meta:map [string] string(nil),FileStateOS: file.StateOS {Inode:0x2466a,Device:0xfc00}},TimeSeries:false},标志:0x1,Cache:publisher.EventCache {m:common.MapStr(nil)}}(状态= 400):{“类型”: “ mapper_parsing_exception”,“原因”:“无法解析ID为'ZJ_OrHEBZWkJKYxN4WlY'的文档中[date]类型的字段[user_agent.version]。字段值的预览:'80 .0.3987.163'“,” caused_by“:{” type“:” illegal_argument_exception“,” reason“:”无法解析格式为[strict_date_optional_time || epoch_millis]的日期字段[80.0.3987.163]“, “ caused_by”:{“ type”:“ date_time_parse_exception”,“ reason”:“无法使用所有封闭的解析器进行解析”}}}
问题开始:
{“ type”:“ mapper_parsing_exception”,“原因”:“无法解析ID为'ZJ_OrHEBZWkJKYXN4WlY'的文档中[date]类型的字段[user_agent.version]。字段值的预览:'80 .0.3987.163'”, “ caused_by”:{“ type”:“ illegal_argument_exception”,“ reason”:“无法解析格式为[strict_date_optional_time || epoch_millis]的日期字段[80.0.3987.163]”,“ caused_by”:{“ type”:“ date_time_parse_exception” ,“原因”:“无法使用所有封闭的解析器进行解析”}}}
不知道为什么我的99%的日志表现良好,但使用chrome输入:“((KHTML,像Gecko一样)Chrome /”-解析时无法解析字段[user_agent.version]
使用Filebeat / Elasticsearch / Kibana-版本7.6.2
感谢您的建议
您使用的是标准Filebeat模板还是使用自己的模板?
我有相同的问题,因为我使用的是自己的模板,但未定义“ user_agent”字段。我通过从Filebeat模板复制它们来添加它们,目前它没有给我带来任何问题。