added newsyslog rules for FreeBSD#1724
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #1724 +/- ##
========================================
Coverage 68.66% 68.66%
========================================
Files 82 82
Lines 11737 11737
Branches 1645 1645
========================================
Hits 8059 8059
Misses 3326 3326
Partials 352 352 Continue to review full report at Codecov.
|
| @@ -0,0 +1 @@ | |||
| /var/log/waagent.log 644 7 * @T00 J /var/run/waagent.pid | |||
There was a problem hiding this comment.
A couple of questions:
-
If I'm reading the documentation correctly, by adding waagent.pid, the agent would be sent a SIGHUP on rotation... how does the agent handle this signal?
-
From the documentation it was not clear to me how optional fields are specified. I see that you skipped owner (2nd field). Are the TABs between "waagent.log" and "644" significant? I also see a TAB between "*" and "@t00"
Thanks
There was a problem hiding this comment.
Hi, man page of newsyslog.conf reads as: "Each line has five mandatory fields and four optional fields, separated with whitespace". Any number of TABs or SPACEs count as whitespace.
There was a problem hiding this comment.
Hi,
SIGHUP is not needed as FileAppender.write in azurelinuxagent/common/logger.py closes the logfile after each write. I removed the pid file from the newsyslog config.
BR, Felix
Description
waagent logs to /var/log/waagent.log. On FreeBSD, this logfile happens to grow. In contrast to Linux, there is no logrotate. Instead, every FreeBSD installation comes with newsyslog, which is similar to logrotate. The configuration of newsyslog is modular, i.e. the main configuration file /etc/newsyslog.conf also reads every file in the directory /etc/newsyslog.conf.d. My patch places a newsyslog config file for waagent in /etc/newsyslog.conf.d, which rotates the log file every midnight, and keeps up to 7 historical, compressed logfiles. setup.py was modified to copy over this configuration file on FreeBSD.
PR information
Quality of Code and Contribution Guidelines
This change is