Results 1 to 10 of 10

Thread: Auto clean up large spamassassin log files

  1. #1
    Member
    Join Date
    Apr 2005
    Posts
    105

    Default Auto clean up large spamassassin log files

    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. #2
    Member Manuel_accu's Avatar
    Join Date
    Jun 2005
    Posts
    191

    Default

    Hi,

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

    thx
    Linux Web Administrator Guide
    Optimize, secure and performance tunning for Apache || MySQL5.1 Cluster How To
    The visionary conceives the impossible, The missionary makes it possible. ...Gita.

  3. #3
    Member
    Join Date
    Apr 2005
    Posts
    105

    Default

    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.
    Last edited by wkdwich; 09-20-2006 at 07:46 AM.

  4. #4
    Member Manuel_accu's Avatar
    Join Date
    Jun 2005
    Posts
    191

    Default

    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.
    Linux Web Administrator Guide
    Optimize, secure and performance tunning for Apache || MySQL5.1 Cluster How To
    The visionary conceives the impossible, The missionary makes it possible. ...Gita.

  5. #5
    Member MRiscado's Avatar
    Join Date
    Feb 2004
    Posts
    22

    Default

    Quote Originally Posted by wkdwich
    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

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

  6. #6
    Member
    Join Date
    Apr 2005
    Posts
    105

    Default

    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. #7
    Member
    Join Date
    Jun 2005
    Posts
    402

    Default

    This will empty every file in each user's .spamassassin folder

    #!/bin/bash

    clear

    echo
    echo "This will delete all Spamassassin Logs!!!"
    echo

    for user in `ls /home`; do
    if [ -d /home/$user/.spamassassin ]; then
    echo "Processing $user......."
    for file in `ls /home/$user/.spamassassin`; do
    cat < /dev/null > /home/$user/.spamassassin/$file
    done
    fi
    sleep 1
    done

    exit
    Is that what you were wanting? Are all the files log files?

  8. #8
    Member
    Join Date
    Apr 2005
    Posts
    105

    Default

    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. #9
    Member
    Join Date
    Jun 2005
    Posts
    402

    Default

    Quote Originally Posted by wkdwich
    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
    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. #10
    Registered User
    Join Date
    Aug 2005
    Posts
    1

    Default

    Quote Originally Posted by beehave
    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?
    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.

Similar Threads

  1. Rotation for Large Munin log files [Case 37444]
    By fuzioneer in forum Feature Requests for cPanel & WHM
    Replies: 17
    Last Post: 07-09-2012, 11:18 AM
  2. How to clean large SPAM email boxes?
    By emurad in forum E-mail Discussions
    Replies: 1
    Last Post: 03-09-2011, 06:10 AM
  3. How to clean large SPAM email boxes?
    By emurad in forum cPanel & WHM Discussions
    Replies: 1
    Last Post: 03-09-2011, 06:10 AM
  4. Rotation for Large Munin log files [Case 37444]
    By fuzioneer in forum cPanel & WHM Discussions
    Replies: 0
    Last Post: 01-21-2010, 01:58 PM
  5. clean-up log files
    By ramil in forum cPanel & WHM Discussions
    Replies: 0
    Last Post: 03-27-2006, 12:53 PM