3
我正在使用Bunyan和bunyas-lumberjack將日誌發送到日誌存儲並在彈性搜索中對其進行索引。我現在面臨的問題是,當我過濾日誌:我使用的是基本的過濾器Logstash:NodeJS Bunyan Logstash日誌索引
filter {
if [type == "json"]{
json {
source => "message"
}
}
}
,它將在JSON從班揚到source.message場和索引它的彈性搜索。如何將bunyan的每個字段都編入特定的彈性搜索字段,以便我可以搜索它或在Kibana中使用它?
我附上了我現在所獲得的以及我想要獲得的內容作爲示例。 目前:
{
"_index": "logstash-2015.10.26",
"_type": "json",
"_id": "AVCjvDHWHiX5VLMgQZIC",
"_score": null,
"_source": {
"message": "{\"name\":\"myLog\",\"hostname\":\"atnm-4.local\",\"pid\":6210,\"level\":\"error\",\"message\":\"This should work!\",\"@timestamp\":\"2015-10-26T10:40:29.503Z\",\"tags\":[\"bunyan\"],\"source\":\"atnm-4.local/node\"}",
"@version": "1",
"@timestamp": "2015-10-26T10:40:31.184Z",
"type": "json",
"host": "atnm-4.local",
"bunyanLevel": "50"
},
尋求:
{
"_index": "logstash-2015.10.26",
"_type": "json",
"_id": "AVCjvDHWHiX5VLMgQZIC",
"_score": null,
"_source": {
"message": {
"name": example,
"hostname": example,
"etc": example
看來,通過在伐木工人中添加編解碼器作爲json,一切都會運行良好:codec => json,但我不認爲我仍然可以索引syslogs,對吧? – alexsc