Koozali.org: home of the SME Server

SpamFilter and Antivirus Stats

Offline Brave Dave

  • *
  • 185
  • +0/-0
SpamFilter and Antivirus Stats
« on: March 23, 2005, 08:49:09 PM »
With the Stats that run from the cron job with these contribs from http://sme.swerts-knudsen.dk/

They only report part of the day, I'm guessing that this changes with the timezone, but I only see 15-23

I have ensured it is the latest version and both have the previously mentioned

$opt{'timezone'} = date +%Z;
Date_Init("TZ=$opt{'timezone'}");

to work around I change part of the parse_arg subroutine to be as follows and I get the desired results (at least I do in the spamfilter one, haven't tried the av one)
  #if(!$start && !$end) {
    $end = time;
    $start = $end - $secsinday;
    return ($start, $end);
  #}

My TimeZone is reported as EST

Is there a better answer ?
.:DB:.

Offline chris burnat

  • *****
  • 1,135
  • +2/-0
    • http://www.burnat.com
SpamFilter and Antivirus Stats
« Reply #1 on: March 24, 2005, 11:01:00 AM »
Funny you mentioned this....  I had asked Jesper about the same thing the other day, and he confirmed that EST is worldwide US east coast time zone.  He suggested I tried this from a command line - as root:

# export TZ=GMT+11

Googling for export TZ= will tell you the whole story.  You can make this environment permanent by inserting the command in /etc/profile  . I have tested the effect by running the script manually (/usr/bin/spamfilter-stats.pl) and spams events are now reported over 24 hours, not 6 as previously the case.  Done this today, so midnight will tell if all is OK...  Will let you know. chris.
- chris
If it does not work out of the box, please fill in a Bug Report @ Bugzilla (http://bugs.contribs.org)  - check: http://wiki.contribs.org/Bugzilla_Help .  Thanks.

Offline Brave Dave

  • *
  • 185
  • +0/-0
SpamFilter and Antivirus Stats
« Reply #2 on: March 24, 2005, 11:03:33 PM »
Ok thanks for the reply

I'm going to change the date line in the scrip to read

$opt{'timezone'} = date +%z;

date +%z returns
TimeZone = +1000

rather than the EST denotion, my Fedora servers also return EST - I'm guessing it may also do that on the east coast of Africa

will await midnight for the result
.:DB:.

Offline chris burnat

  • *****
  • 1,135
  • +2/-0
    • http://www.burnat.com
SpamFilter and Antivirus Stats
« Reply #3 on: March 25, 2005, 04:04:31 AM »
I have drawn a blank at midnight.  Same as before because inserting the command "export TZ=GMT+11" in /etc/profile does not affect system time, it only changes time zone for bash, correct?  Back to the drawing board I am efraid...


Quote from: "davidbray"

I'm going to change the date line in the scrip to read

$opt{'timezone'} = date +%z;

date +%z returns
TimeZone = +1000


Where is this script located?
regards
chris
- chris
If it does not work out of the box, please fill in a Bug Report @ Bugzilla (http://bugs.contribs.org)  - check: http://wiki.contribs.org/Bugzilla_Help .  Thanks.

Offline Brave Dave

  • *
  • 185
  • +0/-0
SpamFilter and Antivirus Stats
« Reply #4 on: March 25, 2005, 06:54:23 AM »
/usr/bin/spamfilter-stats.pl
/usr/bin/antivirus-stats.pl


line 36/37
$opt{'timezone'} = date +%z;
.:DB:.

Offline chris burnat

  • *****
  • 1,135
  • +2/-0
    • http://www.burnat.com
SpamFilter and Antivirus Stats
« Reply #5 on: March 25, 2005, 07:41:58 AM »
Quote from: "davidbray"
/usr/bin/spamfilter-stats.pl
/usr/bin/antivirus-stats.pl

line 36/37
$opt{'timezone'} = date +%z;


Thanks David. Done it and its looking much better, I think you done it!  Removed all changes in etc/profile [back to EST = +11 in NSW, +10 for you in QLD] and just executed spamfilter-stats.pl

Results:

Period Beginning : Thu 24 Mar 2005 05:32:34 PM EST
Period Ending    : Fri 25 Mar 2005 05:32:34 PM EST
Reporting Period : 24.00 hrs

And we now have spam counts for each hour of the day, as applicable. Let see what happen at midhnight when cron do it on its own.. cheers.  chris.

PS: foced a cron job at 19:25 this arvo, and got:
Period Beginning : Thu Mar 24 19:25:01 2005
Period Ending    : Fri Mar 25 19:25:01 2005
Reporting Period : 24.00 hrs
fixed I think.
- chris
If it does not work out of the box, please fill in a Bug Report @ Bugzilla (http://bugs.contribs.org)  - check: http://wiki.contribs.org/Bugzilla_Help .  Thanks.

Offline Brave Dave

  • *
  • 185
  • +0/-0
SpamFilter and Antivirus Stats
« Reply #6 on: March 25, 2005, 09:52:00 PM »
Yes: Fixed here too
.:DB:.