Logstash神交模式的思科交换机的日志

问题描述 投票:1回答:1

我具有由Cisco交换机如下系统日志消息

<189>11762: SW01: ]: Oct 19 15:46:15.776 GMT: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/0/5, changed state to up

我想SW01后删除],并成功使用下面的模式:

<%{NUMBER:message_type_id}>%{NUMBER:internal_id}:%{SPACE}%{SYSLOGHOST:origin_hostname}:%{SPACE}\]:%{SPACE}%{CISCOTIMESTAMP:cisco_timestamp}

这种模式产生下面的输出:

{
"internal_id": "11762",
"cisco_timestamp": "Oct 19 15:46:15.776",
"message_type_id": "189",
"origin_hostname": "SW01"
}

但是当我尝试时间戳以下后另一模式补充:

\%%{WORD:facility}-%{INT:severity}-%{WORD:mnemonic}: %{GREEDYDATA:msg}

神交调试器:

Provided Grok patterns do not match data in the input

我怎么能对上述系统日志消息的模式匹配?

任何帮助表示高度赞赏

谢谢

logstash logstash-grok
1个回答
0
投票

用这个 :

<%{NUMBER:message_type_id}>%{NUMBER:internal_id}:%{SPACE}%{SYSLOGHOST:origin_hostname}:%{SPACE}\]:%{SPACE}%{CISCOTIMESTAMP:cisco_timestamp}%{SPACE}%{DATA:gmt}:%{SPACE}%{PROG}%{WORD:facility}-%{INT:severity}-%{WORD:mnemonic}:%{SPACE}%{GREEDYDATA:msg}
© www.soinside.com 2019 - 2024. All rights reserved.