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.

rotating lastlog

Discussion in 'General Discussion' started by Harryhood, Aug 23, 2005.

  1. Harryhood

    Harryhood Well-Known Member

    Joined:
    Jun 3, 2003
    Messages:
    57
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Gamehenge
    It appears that /var/log/lastlog is not being rotated on one of my servers. logrotate.conf has the following entry:


    # no packages own wtmp or lastlog-- we'll rotate them here
    /var/log/wtmp {
    monthly
    create 0664 root utmp
    rotate 1
    }

    Which I assumed would take are of the lastlog file. Any ideas on the best way to add the lastlog file to logrotate?

    Thanks,
     
  2. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    That won't touch lastlog. You could try adding a similar segment into logrotate.conf :

    Code:
    /var/log/wtmp {
      monthly
      create 0664 root root
      rotate 4
    }
    
    Then force a full logrotation:

    /usr/sbin/logrotate -vf /etc/logrotate.conf
     
  3. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
    Um, would it be more like:

    Code:
    /var/log/lastlog {
      monthly
      create 0664 root root
      rotate 4
    }
    
    or am I missing something?

    By the way, is it safe to rotate /var/log/lastlog? This never seems to have been rotated for me.
     
  4. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    So, you spotted my cut&paste error, eh? ;)

    Yes, it should be as you corrected it. There's no problems rotating lastlog, it's just one of those files that doesn't come with a rotation configuration. In fact, if you delete lastlog it doesn't get recreated automatically, you have to touch the file to get it going again. Be aware that some rootkit checking tools might throw up an exception when you rotate lastlog as that can be a favourite trick of hackers and so it is checked for.
     

Share This Page