send_log('/var/log/messages');
send_log('/var/log/syslog');
+my @binary_logfiles;
foreach my $logfile (get_files_recursively('/var/log')) {
- send_log($logfile);
+ # Only continuously monitor a log if it looks like a text file, otherwise
+ # upload as a single file since sending output line-by-line may corrupt
+ # files that aren't append-only
+ if (-T $logfile) {
+ send_log($logfile);
+ } else {
+ push @binary_logfiles, $logfile;
+ }
}
# These files will be sent once
send_file('/var/log/lastlog'); # Previously logged in users
send_file('/var/log/wmtp'); # Current logged in users
-foreach my $logfile (get_files_recursively('/etc/pam.d'),
- get_files_recursively('/etc/rc/init.d'),
- get_files_recursively('/etc/ssh'),
- get_files_recursively('/etc/security'),
- get_files_recursively('/etc/sysconfig'),
- get_files_recursively('/etc/cron*'),
- get_files_recursively('/etc/init.d')) {
- send_file($logfile);
+foreach my $file (get_files_recursively('/etc/pam.d'),
+ get_files_recursively('/etc/rc/init.d'),
+ get_files_recursively('/etc/ssh'),
+ get_files_recursively('/etc/security'),
+ get_files_recursively('/etc/sysconfig'),
+ get_files_recursively('/etc/cron*'),
+ get_files_recursively('/etc/init.d'),
+ @binary_logfiles) {
+ send_file($file);
}
# These commands will have their output sent as they are updated