fail2ban and logrotate

Asked by Todd Bradshaw

This Error showed up in my logrotate cron emails after installing fail2ban.
error: error running non-shared postrotate script for /var/log/fail2ban.log of '/var/log/fail2ban.log '

the fail2ban logrotate script is as follows:
/var/log/fail2ban.log {

    weekly
    rotate 4
    compress

    delaycompress
    missingok
    postrotate
        fail2ban-client set logtarget /var/log/fail2ban.log >/dev/null
    endscript

    # If fail2ban runs as non-root it still needs to have write access
    # to logfiles.
    # create 640 fail2ban adm
    create 640 root adm
}

I am guessing that I get the errors because of fail2ban not being ran as a server.

todd@doc:~$ fail2ban-client set logtarget /var/log/fail2ban.log
ERROR Unable to contact server. Is it running?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu fail2ban Edit question
Assignee:
No assignee Edit question
Solved by:
Todd Bradshaw
Solved:
Last query:
Last reply:
Revision history for this message
Todd Bradshaw (snooptodd) said :
#1

So here I go answering my own question.
I have 3 choices
1. change fail2ban to run as a server.
2. comment out the postrotate part of the script
3. live with it.

I will go with 3 because i am lazy and none of the other changes will upgrade well.