我有点困惑。我正在尝试拔出syslog date (backfilling the logstash)
并用它替换@timestamp
。我几乎什么都试过了。
这是我的过滤器
filter {
if [type] == "syslog" {
grok {
match => {
"message" => ["%{SYSLOGTIMESTAMP:DATETIME} %{WORD:SERVER} (?<BINARY>(.*?)(php\-cgi|php))\: %{DATA:PHP_ERROR_TYPE}\:\s\s(?<PHP_ERROR_DESC>(.*?)(e\s\d))""]
}
}
date {
match => { "DATETIME" => [ "MMM d HH:mm:ss", "MMM dd HH:mm:ss", "ISO8601" ] }
target => "@timestamp"
add_tag => [ "tmatch" ]
}
if !("_grokparsefailure" in [tags]) {
mutate {
replace => [ "@source_host", "%{SERVER}" ]
}
}
mutate {
remove_field => [ "SERVER" ]
}
}
}
样本输出:
{
"message" => "Sep 10 00:00:00 xxxxxxx",
"@timestamp" => "2013-12-05T13:29:35.169Z",
"@version" => "1",
"type" => "xxxx",
"host" => "127.0.0.1:xxx",
"DATETIME" => "Sep 10 00:00:00",
"BINARY" => "xxxx",
"PHP_ERROR_TYPE" => "xxxx",
"PHP_ERROR_DESC" => "xxxxx",
"tags" => [
[0] "tmatch"
],
"@source_host" => "xxx"
}
tmatch 在标签中,所以我假设日期过滤器有效,但为什么我仍然有:
@timestamp => "2013-12-05T13:29:35.169Z"
?
感谢您的帮助(我logstash
的是logstash-1.2.2-flatjar.jar
)