Unidata / LDM

The Unidata Local Data Manager (LDM) system includes network client and server programs designed for event-driven data distribution, and is the fundamental component of the Unidata Internet Data Distribution (IDD) system.
http://www.unidata.ucar.edu/software/ldm
Other
43 stars 27 forks source link

Added SIGHUP handler used to reopen log file. #39

Closed khallock closed 7 years ago

khallock commented 9 years ago

I work for the Data Center at the University of Wisconsin-Madison Space Science and Engineering Center. In the past we have used (r)syslog with noaaportIngester to log messages for each NOAAPORT channel as suggested by the installation documentation: EXEC "noaaportIngester -m 224.0.1.1 -n -u 3" (in ~ldm/etc/ldmd.conf) local3.debug /usr/local/ldm/logs/nwstg.log (in /etc/rsyslog.conf)

However, our IT group recently began utilizing rsyslog for remote logging, so we are now logging directly to files: EXEC "noaaportIngester -m 224.0.1.1 -n -l /usr/local/ldm/logs/nwstg.log" (~ldm/etc/ldmd.conf)

After changing to this direct logging method, our log rotation scripts are no longer working as before. With (r)syslog, we could rotate our logs by renaming the log files and then running hupsyslog (provided with LDM). When logging directly to files, there does not currently seem to be a way to rename currently open log files and open a new log file with the original name (without completely killing the noaaportIngester processes or restarting LDM).

I have modified noaaportIngester.c to call closeulog() when it receives SIGHUP, allowing us to rotate these log files without any noaaportIngester downtime (similarly to what we did previously with syslog).

semmerson commented 7 years ago

Effectively incorporated into version 6.13.0. Note that later versions use SIGUSR1 rather than SIGHUP to prevent termination of child processes that don't handle SIGHUP (e.g., McIDAS decoders).