消息看起來像_grokparsefailure上的漆登錄
1.2.3.4 "-" - - [19/Apr/2016:11:42:18 +0200] "GET http://monsite.vpù/api/opa/status HTTP/1.1" 200 92 "-" "curl - API-Player - PREPROD" hit OPA-PREPROD-API - 0.000144958
我神交模式
grok {
match => { "message" => "%{IP:clientip} \"%{DATA:x_forwarded_for}\" %{USER:ident} %{USER:auth} \[%{HTTPDATE:timestamp}\] \"(?:%{WORD:verb} %{NOTSPACE:request}(?: HTTP/%{NUMBER:httpversion})?|%{DATA:rawrequest})\" %{NUMBER:response} (?:%{NUMBER:bytes}|-) %{QS:referrer} %{QS:agent} (%{NOTSPACE:hitmiss}|-) (%{NOTSPACE:varnish_conf}|-) (%{NOTSPACE:varnish_backend}|-) %{NUMBER:time_firstbyte}"}
}
我有一個grokparsefailure標籤,而我所有的字段除了最後一個正確履行,我得到0而不是的0.000144958
在ES完整消息是
{
"_index": "logstash-2016.04.19",
"_type": "syslog",
"_id": "AVQt7WSCN-2LsQj9ZIIq",
"_score": null,
"_source": {
"message": "212.95.71.201 \"-\" - - [19/Apr/2016:11:50:12 +0200] \"GET http://monsite.com/api/opa/status HTTP/1.1\" 200 92 \"-\" \"curl - API-Player - PREPROD\" hit OPA-PREPROD-API - 0.000132084",
"@version": "1",
"@timestamp": "2016-04-19T09:50:12.000Z",
"type": "syslog",
"host": "212.95.70.80",
"tags": [
"_grokparsefailure"
],
"application": "varnish-preprod",
"clientip": "1.2.3.4",
"x_forwarded_for": "-",
"ident": "-",
"auth": "-",
"timestamp": "19/Apr/2016:11:50:12 +0200",
"verb": "GET",
"request": "http://monsite.com/api/opa/status",
"httpversion": "1.1",
"response": "200",
"bytes": "92",
"referrer": "\"-\"",
"agent": "\"curl - API-Player - PREPROD\"",
"hitmiss": "hit",
"varnish_conf": "OPA-PREPROD-API",
"varnish_backend": "-",
"time_firstbyte": "0.000132084",
"geoip": {
"ip": "1.2.3.4",
"country_code2": "FR",
"country_code3": "FRA",
"country_name": "France",
"continent_code": "EU",
"region_name": "C1",
"city_name": "Strasbourg",
"latitude": 48.60040000000001,
"longitude": 7.787399999999991,
"timezone": "Europe/Paris",
"real_region_name": "Alsace",
"location": [
7.787399999999991,
48.60040000000001
]
},
"agentname": "Other",
"agentos": "Other",
"agentdevice": "Other"
},
"fields": {
"@timestamp": [
1461059412000
]
},
"highlight": {
"agent": [
"\"curl - API-Player - @[email protected]@/[email protected]\""
],
"varnish_conf": [
"[email protected]@[email protected]/[email protected]"
],
"application": [
"@[email protected]@/[email protected]@[email protected]@/[email protected]"
],
"message": [
"1.2.3.4 \"-\" - - [19/Apr/2016:11:50:12 +0200] \"GET http://monsote.com/api/opa/status HTTP/1.1\" 200 92 \"-\" \"curl - API-Player - @[email protected]@/[email protected]\" hit [email protected]@[email protected]/[email protected] - 0.000132084"
]
},
"sort": [
1461059412000
]
}
答案是kibana不會顯示非常小的數字
感謝Alain,我確實刪除了所有索引以創建新的索引。現在映射對於time_firstbyte是正確的(它是字符串),但仍然是'0'和grokparsefailure。我還申請你的想法(:INT) – glmrenard
網站http://grokconstructor.appspot.com/do/match#result確認我神交模式爲正常(見圖片) – glmrenard
我試試你的想法'神交{ 匹配=> { 「消息」=>「%{IP:clientip} \」%{DATA:x_forwarded_for} \「%{USER:ident}%{USER:auth} \ [%{HTTPDATE:timestamp} \] \」(?:% {WORD:verb}%{NOTSPACE:request}(?: HTTP /%{NUMBER:httpversion})?|%{DATA:rawrequest})\「%{NUMBER:response}(?:%{NUMBER:bytes} - )%{QS:引薦}%{QS:代理}(%{NOTSPACE:hitmiss} | - )%{USERNAME:varnish_conf}%{USERNAME:varnish_backend}%{NUMBER:time_firstbyte:INT}「} tag_on_failure => [「_grokparsefailure_varnish」]'但我的grok消息仍然是_grokparsefailure ' – glmrenard