필자는 다중 행 이벤트를 결합한 원격 시스템을 보유하고 있으며이를 등재 프로토콜을 통해 보냅니다. grok/logstash의 개행과 어떻게 일치합니까?
{
"message" => "2014-10-20T20:52:56.133+0000 host 2014-10-20 15:52:56,036 [ERROR ][app.logic ] Failed to turn message into JSON\nTraceback (most recent call last):\n File \"somefile.py", line 249, in _get_values\n return r.json()\n File \"/path/to/env/lib/python3.4/site-packages/requests/models.py\", line 793, in json\n return json.loads(self.text, **kwargs)\n File \"/usr/local/lib/python3.4/json/__init__.py\", line 318, in loads\n return _default_decoder.decode(s)\n File \"/usr/local/lib/python3.4/json/decoder.py\", line 343, in decode\n obj, end = self.raw_decode(s, idx=_w(s, 0).end())\n File \"/usr/local/lib/python3.4/json/decoder.py\", line 361, in raw_decode\n raise ValueError(errmsg(\"Expecting value\", s, err.value)) from None\nValueError: Expecting value: line 1 column 1 (char 0), Failed to turn message into JSON"
}
내가
grok {
match => [ "message", "%{TIMESTAMP_ISO8601:timestamp} \[%LOGLEVEL:loglevel}%{ SPACE}\]\[%{NOTSPACE:module}%{SPACE}\]%{GREEDYDATA:message}" ]
}
GREEDYDATA
와 메시지를 일치하도록 시도
은 다음과 같다 무언가이다.
그래서 그때 GSUB 사용하려 :
mutate {
gsub => ["message", "\n", "LINE_BREAK"]
}
# Grok goes here
mutate {
gsub => ["message", "LINE_BREAK", "\n"]
}
을하지만 하나보다는
The Quick brown fox
jumps over the lazy
groks
내가
The Quick brown fox\njumps over the lazy\ngroks
그래서있어
...
를 작동하지 않았다어떻게 추가할까요? 개행 문자를 다시 내 데이터로 보내고 GREEDYDATA
을 내 개조 문자와 일치 시키거나 다른 방법으로 내 메시지의 관련 부분을 가져 오겠습니까?
이 http://stackoverflow.com/questions/24307965/logstash-grok-multiline-message의 중복처럼 보인다. –
@ MagnusBäck는 기본적으로 yes입니다.하지만 그 질문은 개행을 신경 쓰지 않지만 결과 메시지에 개행이 필요합니다. –