forked from zeek/zeekctl
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix post-terminate to not generate invalid timestamps
Fixed the code that tries to extract the base name and timestamp from a log filename, because it wasn't extracting them correctly when the base name contained a period (this doesn't happen for any of the standard Bro logs) or if the timestamp in the filename wasn't in the format YYYY-MM-DD-HH-MM-SS (this could happen if Bro terminates but for some reason doesn't execute the code in the writers/ascii.bro script that renames the log, or if someone uses a different format by redefining Log::default_rotation_date_format). The fix involves first removing the log suffix, then trying to extract the timestamp in one of the two default timestamp formats. This procedure is more reliable than the previous method of making assumptions about how many period characters should be in a log filename. Also, when Bro terminates normally, post-terminate now just tries to archive all log files, instead of only those that were rotated. This is to avoid missing any logs. This also means that the stderr.log/stdout.log files are now archived when Bro terminates normally (instead of only when Bro crashes), which is useful to capture any error messages from archive-log or Bro. Also fixed an issue that could occasionally occur when post-terminate archives an unrotated log file (i.e., no timestamp in the filename) and a different log with the same base name was archived after post-terminate started, then the computed start time of the unrotated log would be later than the end time. Fixed by setting the start time to equal the end time. Also added the node name to the subject line in the email sent when post-terminate fails to archive a log.
- Loading branch information
Daniel Thayer
committed
Jan 13, 2017
1 parent
d5475e9
commit a721ed1
Showing
1 changed file
with
121 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters