Mysql 如何在rsyslog中仅插入常规日志中的mac地址?
嗨,如何从常规日志中仅插入类似于“22:22:22:22:22”的mac地址 我的rsyslog模板:Mysql 如何在rsyslog中仅插入常规日志中的mac地址?,mysql,regex,rsyslog,Mysql,Regex,Rsyslog,嗨,如何从常规日志中仅插入类似于“22:22:22:22:22”的mac地址 我的rsyslog模板: $template fw,"insert into fw(Message, Facility, FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag, EventID) values ('%msg%', %syslogfacility%,'%fromhost%', %syslogpriority%,
$template fw,"insert into fw(Message, Facility, FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag, EventID) values ('%msg%', %syslogfacility%,'%fromhost%', %syslogpriority%, '%timereported:::date-mysql%', '%timegenerated:::date-mysql%', %iut%, '%syslogtag%', '123')",SQL
我尝试像这样使用正则表达式,但在mysql表中只得到字符串“src mac”
%msg:R,ERE,0,FIELD:src-mac--end%
日志文本消息如下所示:
Pay: srcnat: in:(none) out:wan, src-mac 22:22:22:22:22:22,
proto TCP (SYN), 10.5.50.100:1111->111.11.111.11:443, len 52
摄取数据的标准策略是在执行插入之前用某些应用程序语言“清理”数据
除非您使用带有regexp_replace()的MariaDB,否则在SQL中没有简单的方法来选择mac地址。接收数据的标准策略是在执行插入之前用某些应用程序语言“清理”数据 除非您使用带有regexp_replace()的MariaDB,否则在SQL中没有简单的方法来选择mac地址