fluentd event中的tag是在哪里设置的?
结论:在配置文件中定义的!
在配置文件td-agent.conf中设置,如下:
<source> @type tail path /var/log/messages tag system.log <parse> @type syslog </parse> @label @systemlog </source>
然后,在match的部分,就可以使用这个tag
<label @systemlog> <match system.log> @type stdout </match> </label>
然后,生成的fluentd 日志,如下:
2022-11-14 02:02:42.000000000 -0500 system.log: {"host":"centos7","ident":"systemd","message":"Started Session 11 of user root."}
2022-11-14 02:02:42.000000000 -0500 system.log: {"host":"centos7","ident":"systemd-logind","message":"New session 11 of user root."}