我正在尝试获取时间戳、AppName (mm1-spring-music.example.com) 和 Proc id 作为 [RTR] 出现在日志中,AppID(在 app_id 之后出现在日志中:),响应时间(在 response_time 之后出现在日志中:) 来自基于来自 Logstash 的 Syslog 5424 格式的以下日志
2015-08-03T09:51:15.000+00:00 [RTR] OUT mm1-spring-music.example.com - [03/08/2015:09:51:15 +0000] "GET /assets/templates/status.html HTTP/1.1" 200 428 "http://mm1-spring-music.example.com/" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36" X.X.X.XX:37610 x_forwarded_for:"X.X.X.XX, X.X.X.XX" vcap_request_id:5ad09855-f9f3-46a9-7fa7-2095952faf78 response_time:0.002043376 app_id:08be9fc8-c7a3-4613-bf12-1a9c7d98cc27
我对logstash非常陌生,使用以下配置我无法获得所需的输出任何建议都会有很大帮助
input {
stdin{}
}
filter {
if [type] == "syslog" {
grok {
match => { "message" => "%{SYSLOG5424PRI}%{NONNEGINT:syslog5424_ver} +(?:%{TIMESTAMP_ISO8601:syslog5424_ts}|-) +(?:%{HOSTNAME:syslog5424_host}|-) +(?:%{NOTSPACE:syslog5424_app}|-) +(?:%{NOTSPACE:syslog5424_proc}|-) +(?:%{WORD:syslog5424_msgid}|-) +(?:%{SYSLOG5424SD:syslog5424_sd}|-|) +%{GREEDYDATA:syslog5424_msg}" }
}
syslog_pri { }
date {
match => [ "syslog_timestamp", "MMM d HH:mm:ss", "MMM dd HH:mm:ss" ]
}
if !("_grokparsefailure" in [tags]) {
mutate {
replace => [ "@source_host", "%{syslog_hostname}" ]
replace => [ "@message", "%{syslog_message}" ]
}
}
mutate {
remove_field => [ "syslog_hostname", "syslog_message", "syslog_timestamp" ]
}
}
}
output {
# elasticsearch {
# host => "X.X.0.103"
# protocol => "http"
# }
stdout { codec => rubydebug }
#stdout { }
}