- 的Ubuntu 16.04
- Logstash 5.2.1
- ElasticSearch 5.1
我已經配置好了DEIS平臺將日誌發送到我們的沒有問題的Logstack節點。不過,我對Ruby還是個新手,Regexes並不是我的強項。
日誌示例:
2017-02-15T14:55:24UTC deis-logspout[1]: 2017/02/15 14:55:24 routing all to udp://x.x.x.x:xxxx\n
Logstash配置:
input {
tcp {
port => 5000
type => syslog
codec => plain
}
udp {
port => 5000
type => syslog
codec => plain
}
}
filter {
json {
source => "syslog_message"
}
}
output {
elasticsearch { hosts => ["foo.somehost"] }
}
Elasticsearch輸出:
"@timestamp" => 2017-02-15T14:55:24.408Z,
"@version" => "1",
"host" => "x.x.x.x",
"message" => "2017-02-15T14:55:24UTC deis-logspout[1]: 2017/02/15 14:55:24 routing all to udp://x.x.x.x:xxxx\n",
"type" => "json"
期望的結果:
"@timestamp" => 2017-02-15T14:55:24.408Z,
"@version" => "1",
"host" => "x.x.x.x",
"type" => "json"
"container" => "deis-logspout"
"severity level" => "Info"
"message" => "routing all to udp://x.x.x.x:xxxx\n"
我怎樣才能提取信息從消息中爲它們單獨的領域?
你的意思是你的提取*消息*爲四個不同的領域* *(部件如你所提到的)?您是否已經從上面的ES **輸出**中看到了這一點。那麼你在這裏有什麼問題?關於方法? – Kulasangar
對不起,如果這不簡明,我更新了這個問題。 – user7565843