configure rsyslog to monitor direcory files when log file name changed
I have a service that creates a new log file each hour with the hour in the file name i.e: ecs-agent.log.2019-03-26-08
Each time the file changed rsyslog doesnt recognize the change.
the following settings in the conf file will not work:
$InputFileName /var/log/ecs/ecs-agent.log.*
$InputFileStateFile stat-ecs-agent.log.*
Since there is only one log file in the folder active each time - anyway to configure rsyslog to monitor the folder?
Related
I am trying to use watchman to get the directory of the file that was changed. But watchman only returns the file name in the log. Is there a way to configure my watchman trigger config with append-files param so I can get the full path of the file?
I tried to set up new configs for my postgres, but for some reason I can't do it correctly.
First of my trying is to move .pid file to some other location, I can rename the file in postgres.conf but I can't set it to directory I need.
Same situation is with .log file.
Why when I tried to set pid file using external_pid_file = '/home/vagrant/shared/pids/postgres.pid' file isn't created? Or when I tried to set log file to /home/vagrant/shared/logs folder I have the same issue.
My config file:
https://pastebin.com/ud6HSJrn
When i Invoke the installer with:
installerchecker_windows-x64_19_2_1_0-SNAPSHOT.exe
-q
-c
-varfile install.varfile
-Dinstall4j.alternativeLogfile=d:/tmp/logs/installchecker.log
-Dinstall4j.logToStderr=true
it creates and writes the standard log file installation.log in the .install4j Directory, but doesnt create my custom log in d:/tmp/logs. As configured there is an additional error.log with the correct content.
The installation.log shows the comand-line config : install4j.alternativeLogfile=d:/tmp/logs/installchecker.log
The Directory d:/tmp/logs has full access.
Where is the failure in my config ?
The alternative log file is intended to debug situations where the installer fails. To avoid moving the log file to its final destination in .install4j/installation.log, the VM parameter
-Dinstall4j.noPermanentLogFile=true
can be specified.
In nxlog config I have these params set:
SavePos True
ReadFromLast True
When removing lines from a log file (this should never happen) nxlog ships the entire log file. Is this related to how nxlog tracks the line number?
To recreate:
I stop the nxlog service
Delete the nxlog cache (just to make sure im starting fresh)
Right now the log folder ive configured nxlog to watch is empty
I add a new log file to the folder
nxlog ships the log file
I open the log file and add a few lines
nxlog ships those lines
I delete those new lines I just added
nxlog ships the entire log file
NXLog and generally other log shippers are designed to deal with append-only log files.
When you delete lines from the log file it sees that the file size is less. Under the append-only assumption this can only mean that the file was replaced/rotated and the current file is a new one that needs to be fully read.
Also note that when you edit a log file in a text editor the editor will usually replace the file with a new one even if you only append data to the end. This is not equivalent to echo test >> test.log.
If you want to transfer all kinds of changes in files you should use rsync or other tools.
I want to be able to output the currently loaded config filename, is this possible?
I want to basically write out a log entry with the config filename so I know which config file loaded just to verify things.