有以下logstash conf文件:
filter {
if [type] == "TACACS_log" {
grok {
match => { "message" => "%{CISCOTIMESTAMP:JsonTimestamp} %{IP:LogonTo} \s* %{USERNAME:User} \s* %{WORD:Port} \s* %{IP:LogonFrom} %{DATA} cmd=%{GREEDYDATA:command}" }
match => { "message" => "%{CISCOTIMESTAMP:JsonTimestamp} %{IP:LogonTo} \s* %{USERNAME:User} %{WORD:Port} %{DATA} cmd=%{GREEDYDATA:command}" }
add_field => [ "received_at", "%{@timestamp}" ]
add_field => [ "received_from", "%{LogonTo}" ]
}
date {
match => [ "CISCOTIMESTAMP", "MMM d HH:mm:ss", "MMM dd HH:mm:ss" ]
}
}
}
日志通过 logstash 转发器进入,但 CISCOTIMESTAMP 不匹配。示例日志文件:
6 月 11 日 11:32:38 192.168.2.49 用户 tty1 10.1.250.5 stop task_id=176 timezone=EDT service=shell start_time=1434036772 priv-lvl=15 cmd=show running-config