BitDefender Syslog patch

Remy de Ruysscher remy at UNIX-ASP.COM
Tue Aug 23 12:48:25 IST 2005


    [ The following text is in the "ISO-8859-1" character set. ]
    [ Your display is set for the "US-ASCII" character set.  ]
    [ Some characters may be displayed incorrectly. ]

Hi,

When I saw the clamav-autoupdate logging to Syslog I wanted logging for 
BitDefender to Syslog as well. So I made a simple patch for the orginal 
bitdefender-autoupdate script which logs trough Syslog.

Please try it and let me know if it works (or not). It's working on my 
servers quite nicely.

Regards,
Remy.

---


--- old/bitdefender-autoupdate  Tue Aug 23 13:39:04 2005
+++ new/bitdefender-autoupdate  Tue Aug 23 13:39:23 2005
@@ -98,6 +98,8 @@
 #          added to bitdefende report at the end of the update report 
to "see"
 #          the number of viruses includung families otherwise seen as 
one virus only
 #
+# 21-08-05 Added Bitdefender sysloging to the standard maillogs 
(remy at unix-asp.com)
+#
 ############################################################################

 use POSIX;
@@ -105,6 +107,7 @@
 use File::Basename;
 use IO::File;
 use Archive::Zip qw(:ERROR_CODES);
+use Sys::Syslog;

 my $PackageDir = shift || "/usr/local/bdc/";

@@ -166,6 +169,9 @@
 $LOCK_NB = 4;
 $LOCK_UN = 8;

+eval { Sys::Syslog::setlogsock('unix'); }; # This may fail!
+Sys::Syslog::openlog("BitDefender-autoupdate", 'pid, nowait', 'mail');
+
 &checkLogSize;
 &updateLog("----->  Starting update...");

@@ -198,7 +204,8 @@
 {
         my $bitDCmd = $bdcBinary . " --update";
         &updateLog ( "Starting update using BDC built-in function...");
-        &LockBitDefender;                                          # 
lock it...
+       &LockBitDefender;                                          # 
lock it...
+       Sys::Syslog::syslog('info', "BitDefender starting update");
        eval {
          alarm $MaximumTime;
          system $bitDCmd;
@@ -211,11 +218,13 @@
            # We timed out!
            &UnlockBitDefender;
            &updateLog("WARNING BitDefender update timed out");
+           Sys::Syslog::syslog('warn', "BitDefender update timed out");
            alarm 0;
          }
        } else {
          alarm 0;
-         &updateLog("BitDefender update completed");
+         &updateLog("BitDefender updated");
+         Sys::Syslog::syslog('info', "BitDefender updated");
        }

         #system  ("$bitDCmd"); # update
@@ -253,7 +262,8 @@
           {
              $ftp->quit;
              &updateLog ( "Database is Up to Date - No update is 
required\n");
-             goto ENDING;
+             Sys::Syslog::syslog('info', "Bitdefender update not needed");
+            goto ENDING;
           }
            $ftp->get ( $ftpUpdateFile,  $zipName);
            if ( $verbose ==1 )
@@ -311,6 +321,7 @@
 else
 {
  &updateLog ( "No new definitions found...");
+ Sys::Syslog::syslog('info', "Bitdefender update not needed");
  $useSMTP = 0;                               # avoid mail
 }

------------------------ MailScanner list ------------------------
To unsubscribe, email jiscmail at jiscmail.ac.uk with the words:
'leave mailscanner' in the body of the email.
Before posting, read the Wiki (http://wiki.mailscanner.info/) and
the archives (http://www.jiscmail.ac.uk/lists/mailscanner.html).

Support MailScanner development - buy the book off the website!



More information about the MailScanner mailing list