1. add file /etc/rsyslog.d/test_one.conf:
Code: Select all
# Config for file input test
$ModLoad imfile
$InputFileName /root/test_one.log
$InputFileTag test_one:
$InputFileSeverity notice
$InputFileStateFile state_test_one
$InputFilePersistStateInterval 25000
$InputFileFacility local0
$InputRunFileMonitor
local0.* /var/log/test_one.log
&~
3.restart services
Code: Select all
systemctl restart systemd-journald.socket
systemctl restart rsyslog
Code: Select all
Nov 03 06:17:34 192-168-123-218 rsyslogd[104982]: imfile: on startup file '/root/test_one.log' does not exist but is configured in static file monitor - this may indicate a misconfiguration. If the file appears at a later time, it will automatically be processed. Reason: Permission denied [v8.24.0-34.el7]
Environment
rsyslog version: v8.24.0-34.el7
platform: CentOS Linux release 7.6.1810 (Core), kernel 3.10.0-957.10.1.el7.x86_64