我有以下系统日志消息:
“ 54:07 + 04:00 test-ls100.pi.com----1,2019 / 09/04 09:54:06,4645646546,USERID,登录,5000,2019 / 09/04 09:54:06,vsys1,192.168.1.2,lst \ atest,ls220-test-LaPool,0,1,2700,0,0,agent ,, 37742033,0x0,0,0,0,0,,test- ls100,1,,2019/09/04 09:54:05,1,0x0,lst \ atest“,syslog.local7.info
“ 59:47 + 04:00 test2-ls200.dbi.lan----1,2019 / 09/04 03:59:47,007000016266,系统,vpn,0,2019 / 09/04 03:59:47 ,,隧道状态,IPSEC-隧道-Microsoft,0,0,一般,关键,\“隧道 IPSEC-微软是 up \“,4685867,0x0,0,0,0,0,,test2-ls200”,syslog.local7.crit
如果我在fluentd中使用以下配置:
<source>
type syslog
port 5002
tag syslog
<parse>
time_format
rfc5424_time_format
message_format auto
</parse>
</source>
我得到的输出带有一些经过解析的数据,例如host
:
+0400 syslog.local7.info:{“ host”:“ test-ls100.pi.com”,“ ident”:“-”,“ pid”:“-”,“ msgid”:“-”, “ extradata”:“-”,“ message”:“ 1,2019 / 09/04 10:23:57,5648688596,USERID,登录,5000,2019 / 09/04 10:23:57,vsys1,192.168.1.2,b5 \ sync,test-ls100.pi.com,0,1,2700,0,0,agent ,, 80706441,0x0,0,0,0,0 ,, test-ls100,1,,2019/09/04 10:23:53,1,0x0,b5 \ sync“}
使用syslog.local7.crit用host
等解析相同的数据。
我想做的是解析包含所有信息的字段message
并将差异信息放在不同的字段中,例如获取信息login
或vpn
谁可以也可以是logout
或ssh
或其他类似telnet
的对象,并创建一个字段操作并将其信息放入其中,我想在整个消息字段中使用它。
我知道fluentd拥有解析syslog消息的指南,但老实说,我是一个初学者,我无法理解在我的情况下如何使用他们的说明: