Add support for log rotation on CTA tape servers
Summary
We configured taped to write to a dedicated log file (/var/log/cta/cta-taped.log). When logrotate comes through and renames that log file to cta-taped.[DATE], taped continues writing to cta-taped.[DATE] not the new cta-taped.log. The latter stays 0 size. Other CTA log files don't exhibit this.
What is the expected correct behaviour?
I would expect that the file handle would be closed and a new log file opened
Relevant logs and/or screenshots
In this case, you can see Jan 10 was when taped was started, so now logs are going nowhere as the inode that was cta-taped.log at start no longer exists.
-rw-r--r-- 1 cta tape 0 Jan 11 07:03 cta-rmcd.log-20240112
-rw-r----- 1 root root 0 Jan 11 07:03 cta-taped.log-20240112
-rw-r----- 1 root root 439639 Jan 12 05:49 cta-taped.log-20240111.gz
-rw-r--r-- 1 cta tape 0 Jan 12 05:49 cta-rmcd.log
-rw-r----- 1 root root 0 Jan 12 05:49 cta-taped.log
[root@gmv18017 cta]# ps -ef | grep taped
cta 61664 1 0 Jan10 ? 00:00:00 /usr/bin/cta-taped --log-to-file=/var/log/cta/cta-taped.log
cta 67477 61664 0 Jan11 ? 00:01:07 /usr/bin/cta-taped --log-to-file=/var/log/cta/cta-taped.log
cta 67500 61664 0 Jan11 ? 00:00:54 /usr/bin/cta-taped --log-to-file=/var/log/cta/cta-taped.log
cta 67518 61664 0 Jan11 ? 00:15:36 /usr/bin/cta-taped --log-to-file=/var/log/cta/cta-taped.log
root 73195 73129 0 14:20 pts/0 00:00:00 grep --color=auto taped
Solution
After several iterations the implemented solution will be to create a generic message broadcasting from the Process Manager to all subprocesses keeping the signal handler as the responsible to manage the signal.