通过rsyslog转发日志

####Node Exporter systemctl

[root@Centos7-Dev linux]# cat /usr/lib/systemd/system/node_exporter.service

[Unit]

Description=Node Exporter

Wants=network-online.target

After=network-online.target

[Service]

Type=simple

User=prometheus

Group=prometheus

ExecStart=/data/www/node_exporter/bin/node_exporter --web.listen-address=192.168.91.11:9100 --web.disable-exporter-metrics --collector.tcpstat --collector.logind --collector.processes --collector.textfile.directory=/data/www/node_exporter/data

ExecReload=/bin/kill -HUP

KillMode=process

TimeoutStopSec=20s

Restart=always

SyslogIdentifier=node_exporter

StandardInput=syslog

StandardOutput=syslog

StandardError=syslog

[Install]

WantedBy=default.target

####Rsyslog日志

[root@Centos7-Dev linux]# cat /etc/rsyslog.d/node_exporter.conf

if $programname == "node_exporter" then /data/www/node_exporter/logs/node_exporter.logs

& stop

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容