mysql设置输出格式_rsyslog 配置mysql输出格式
http://www.rsyslog.com/doc/v8-stable/configuration/modules/ommysql.html
文檔中:
Note rsyslog contains a canned default template to write to the MySQL database. It works on the MonitorWare schema. This template is:
$template tpl,”insert into SystemEvents (Message, Facility, FromHost,
Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values
(‘%msg%’, %syslogfacility%, ‘%HOSTNAME%’, %syslogpriority%,
‘%timereported:::date-mysql%’, ‘%timegenerated:::date-mysql%’, %iut%,
‘%syslogtag%’)”,SQL
As you can see, the template is an actual SQL statement. Note the ”,SQL” option: it tells the template processor that the template is used for SQL processing, thus quote characters are quoted to prevent security issues. You can not assign a template without ”,SQL” to a MySQL output action.
If you would like to change fields contents or add or delete your own fields, you can simply do so by modifying the schema (if required) and creating your own custom template.
請問如何修改template或者自定義template呢?
已解決。定義template:
$template tpl,”insert into SystemEvents (Message, Facility, FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values (‘%msg%’, %syslogfacility%, ‘%FROMHOST-IP%’, %syslogpriority%, ‘%timereported:::date-mysql%’, ‘%timegenerated:::date-mysql%’, %iut%, ‘%syslogtag%’)”,SQL
設置ommysql后面直接加上 “;tpl” #template name
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的mysql设置输出格式_rsyslog 配置mysql输出格式的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python elif可以单独使用_Ce
- 下一篇: mysql数据库时间字段看不懂_mysq