Closed job closed 4 years ago
Hi Job, currently this can be achieved using syslog/rsyslog; although you made me notice something regarding this (I point it out a few lines below).
With rsyslog
Edit file /etc/rsyslog.conf
, add the following line to filter FORT validator logs (the logs have the tag 'fort'):
:syslogtag, isequal, "fort:" /var/log/fort.log
With syslog
Here's where I've noticed something that we can improve. Currently the logs have the LOG_DAEMON
facility (see https://github.com/NICMx/FORT-validator/blob/v1.2.0/src/log.c#L40), which can complicate things a bit if you try to send FORT logs to a specific file.
Why? As of today, you can do something like this: edit file /etc/syslog.conf
adding the following line:
daemon.* /var/log/fort.log
This will send all FORT logs to /var/log/fort.log
, but will also send there all logs from any other process that has the DAEMON facility configured.
What can be done? Well, FORT validator should let the operator to configure the facility, so that facilities such as LOCAL[0-7]
can be set. This will aid to send the specific logs to the desired file.
Eg. assuming this could be done using $ fort --log.facility local0
, the following line can be added to /etc/syslog.conf
to send all FORT validator logs to /var/log/fort.log
:
local0.* /var/log/fort.log
Here's the linux man ref of syslog.3.
The likely --log.facility
feature will be added to our TODO list.
Now the version 1.3.0 allows to configure a syslog facility, this way an output file can be configured taking advantage of syslog functions (such as logs rotation).
if (such as in #25) the fort server is forked to the background, it could be useful to be able to specify a filesystem path name which is the stdout/stderr equivalent. perhaps a `--log=/var/log/fort.log' option is useful vs only 'console' or 'syslog'