Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13
I accidentally did "rm -rf /var/logs/*" well I wonder now. Am I screwed and will i never see a log again? Or, well how to fix? Since I kinda want ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Engineer RobinVossen's Avatar
    Join Date
    Aug 2007
    Location
    The Netherlands
    Posts
    1,429

    Removed Log files as root


    I accidentally did "rm -rf /var/logs/*" well I wonder now.
    Am I screwed and will i never see a log again?
    Or, well how to fix? Since I kinda want my logs..
    (eg, dovecot doesnt make a new logfile...)
    New Users, please read this..
    Google first, then ask..

  2. #2
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,729
    AFAIK, Its not possible to recover logs now.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  3. #3
    Linux Engineer RobinVossen's Avatar
    Join Date
    Aug 2007
    Location
    The Netherlands
    Posts
    1,429
    I dont need to recover them
    I just need them to log again :P
    Since dovecot just stopped loggen as did postfix
    New Users, please read this..
    Google first, then ask..

  4. #4
    Blackfooted Penguin daark.child's Avatar
    Join Date
    Apr 2006
    Location
    West Yorks
    Posts
    4,393
    You could try recreating the log files e.g.
    Code:
    cd /var/log
    touch mail mail.err mail.info mail.warn
    You will have to find out which logs postfix and dovecot create and then recreate those log files using touch. Another log to recreate would be /var/log/messages because this is the file used by dmesg.

  5. #5
    oz
    oz is offline
    forum.guy
    Join Date
    May 2004
    Location
    arch linux
    Posts
    18,733
    Yeah, I think daark.child's recommendation might work, at least for some files. I was thinking that most of the log files would rebuild themselves if deleted.

    Have you tried rebooting to see if any would recreate themselves?
    oz

  6. #6
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,729
    AFAIK, log files recreate itself. I could be wrong though.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  7. #7
    Linux Engineer RobinVossen's Avatar
    Join Date
    Aug 2007
    Location
    The Netherlands
    Posts
    1,429
    They are back
    Thanks Daark and some guy from Irc =)
    Anyhow, I tryed rebooting indeed.
    And well I didnt know touch had that function.
    I thought you could use it to change the time created in the file.
    Ah, well it works now =)

    Thanks all.
    New Users, please read this..
    Google first, then ask..

  8. #8
    Blackfooted Penguin daark.child's Avatar
    Join Date
    Apr 2006
    Location
    West Yorks
    Posts
    4,393
    I thought you could use it to change the time created in the file.
    Yes, you can use it for that, but its useful for creating empty files as well. Anyway, I'm glad you managed to resolve the problem. I wasn't sure if all of the logs would be recreated after rebooting.

  9. #9
    Linux Engineer RobinVossen's Avatar
    Join Date
    Aug 2007
    Location
    The Netherlands
    Posts
    1,429
    Well I thought, no problem they will make them selfs again.
    But that just didnt happen.. :o
    So, I kinda paniced Since a Web.MailServer without logs is kinda a pain. (Esspecialy when you never had setup a Mail server)
    Anyhow, how comes that touch can make files? As the function of the tool is to change time?

    Cheers,
    Robin
    New Users, please read this..
    Google first, then ask..

  10. #10
    Blackfooted Penguin daark.child's Avatar
    Join Date
    Apr 2006
    Location
    West Yorks
    Posts
    4,393
    On Linux systems, the manual for touch does not state the file creation capabilities, but I think the info page does. On BSD systems, the manual clearly states that touch modifies file access times as well as create empty files.

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •