- 的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