The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Auto clean up large spamassassin log files

Discussion in 'General Discussion' started by wkdwich, Sep 19, 2006.

  1. wkdwich

    wkdwich Well-Known Member

    Joined:
    Apr 11, 2005
    Messages:
    105
    Likes Received:
    0
    Trophy Points:
    16
    I have over 300 users on this server and many get large volumes of mail daily.. the spamassasin logs get quite large on a regular basis..

    Is there anyone out there that can help me create a script to put to cron.monthly to clear out these logs?

    thanks
     
  2. Manuel_accu

    Manuel_accu Well-Known Member

    Joined:
    Jun 19, 2005
    Messages:
    191
    Likes Received:
    0
    Trophy Points:
    16
    Hi,

    you can configure logrotate for that it will rotate your logs accordingly.

    thx
     
  3. wkdwich

    wkdwich Well-Known Member

    Joined:
    Apr 11, 2005
    Messages:
    105
    Likes Received:
    0
    Trophy Points:
    16
    Manuel, thanks for the response.. can you be a little more specific here?? I assume I need to do something with the logrotate.conf .. below:

    # system-specific logs may be also be configured here.

    But I havent a clue where to go from there..

    Since there is one set of SA files for each domain:

    root@server [/etc]# ls -la /home/wkdwich/.spamassassin
    -rw------- 1 wkdwich wkdwich 2523136 Sep 19 14:54 auto-whitelist
    -rw------- 1 wkdwich wkdwich 93240 Sep 19 14:54 bayes_journal
    -rw------- 1 wkdwich wkdwich 1318912 Sep 19 14:54 bayes_seen
    -rw------- 1 wkdwich wkdwich 10473472 Sep 19 14:54 bayes_toks
    -rw-r--r-- 1 wkdwich wkdwich 1228 Jun 25 2005 user_prefs


    root@server [/etc]# ls -la /home/davyd/.spamassassin
    total 1284
    drwx------ 2 davyd davyd 4096 Sep 19 09:06 ./
    drwx--x--x 13 davyd davyd 4096 Sep 19 09:06 ../
    -rw------- 1 davyd davyd 167936 Sep 19 09:06 auto-whitelist
    -rw------- 1 davyd davyd 83968 Sep 19 09:06 bayes_seen
    -rw------- 1 davyd davyd 1291264 Sep 19 09:06 bayes_toks
    -rw-r--r-- 1 davyd davyd 1230 Apr 23 2005 user_prefs


    you can see how these files are quite large.. the ones for wkdwich domain have been cleared out within the last 30 days

    I would like to rotate them or just clear them out would be sufficent.
     
    #3 wkdwich, Sep 19, 2006
    Last edited: Sep 20, 2006
  4. Manuel_accu

    Manuel_accu Well-Known Member

    Joined:
    Jun 19, 2005
    Messages:
    191
    Likes Received:
    0
    Trophy Points:
    16
    Hi,

    I think you are referring to users specifc lo rotation..? right then you many need to develop a script according to your require ment.
     
  5. MRiscado

    MRiscado Member

    Joined:
    Feb 22, 2004
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1

    Hi wkdwich,
    Any solution to clear all these spamassasin logs by cron?
    Thanks
     
  6. wkdwich

    wkdwich Well-Known Member

    Joined:
    Apr 11, 2005
    Messages:
    105
    Likes Received:
    0
    Trophy Points:
    16
    no, it's probably a simple solution using one of the existing log rotate jobs as a base, but I have been traveling, the desk is piled way too high and I just don't have the skills myself to go down that road..
     
  7. beehave

    beehave Well-Known Member

    Joined:
    Jun 26, 2005
    Messages:
    104
    Likes Received:
    0
    Trophy Points:
    16
    This will empty every file in each user's .spamassassin folder

    Is that what you were wanting? Are all the files log files?
     
  8. wkdwich

    wkdwich Well-Known Member

    Joined:
    Apr 11, 2005
    Messages:
    105
    Likes Received:
    0
    Trophy Points:
    16
    hum, that looks like it might do the trick.. what effect will the echo have if it is run by cron?? I assume that will be in the email notice I will get after the cron runs??

    thanks
     
  9. beehave

    beehave Well-Known Member

    Joined:
    Jun 26, 2005
    Messages:
    104
    Likes Received:
    0
    Trophy Points:
    16
    It would have no effect. You can remove those lines if you want.

    What about the files. Are they all log files? No problems with emptying them?
     
  10. Starfinder

    Starfinder Registered

    Joined:
    Aug 17, 2005
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    You may want to think twice before running this script. As beehave rightly asks, they are not logfiles.

    'user_prefs' is the user preferences, 'auto-whitelist contains addresses which have been auto-added to the whitelist. The rest, I think, are system files used when deciding whether a messages is spam or not.

    I am no spamassassin expert, but i believe this script would just revert the user's spamassassin settings to the server default, and wipe out the accumulated 'learning' data.
     
Loading...

Share This Page