Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can log file messages be deleted? 2

Status
Not open for further replies.

greenpee

Programmer
Aug 3, 2004
39
US
Do you think it is safe to delete messages file from /var/log? I deleted it and recreate the log file, but no log writes in the file. Should I reboot the machine?

-rw-r--r-- 1 root root 0 Aug 6 10:39 messages

Thanks,
 
Yes, it's safe. Whether it's a good idea depends upon the logs in question and the use of the maching.

You need to restart syslogd. That will recreate any log files which are missing. You can't just "touch logfile" to create it while syslogd is running.
 
Thanks lgarner. Yes I touch to create the log file. Could you give me a little detail about what I should do now? I am new bee. Should I stop syslogd first? Should I delete log file I created by touch?
 
The file's ok. Usually you'd enter "/etc/init.d/syslog restart" or maybe "service restart syslog". You can also "kill -HUP" the process; there should be a file like /etc/logrotate.d/syslog with the command syntax.
 
Thanks again lgarner.
smiletiniest.gif
It worked.
 
For future reference, if you want to clear out a file (while it is still in use), issue a "> filename". This is a shortcut to copy /dev/null to the file.

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top