How to clear all kinds of Logs under Debian
Hi,
What is the easiest way to clear all the system logs so that it just looks like a fresh system. I have created a customized image of a debian install on my workstation which I would like to install on numerous identical system. So when the user starts using it, they should just see the logs as if the installed system is fresh. Does any one have scripts like that? thanks |
Anyone?????
|
It's probably not the answer you're looking for :) but I don't let my users have access to the system logs. Those are for root only...
|
Thanks for the kind help.
|
I haven't got a clue, but this might be a start. :scratch:
Code:
$ apt-cache search logfiles |
If you use the logrotate utility then the log files will clear themselves over time.
|
this is the default contents of /var/log on a debian sarge.
All directories inside are empty Code:
drwxr-xr-x 5 root root 4096 2006-01-19 14:04 . |
Thank you guys. Well this has definately given me a start.
|
cat /dev/null > /var/log/messages
cat /dev/null > /var/log/wtmp cat /dev/null > /var/log/maillog etc.. this will delete the contents of the file without removing the file itself or changing any of it's permissions. Repeat as necessary for each log file, write into a bash script whatever.. then delete all the numbered log files ( i.e. messages.1.tar.gz ) which are old logs that have been backed up from logrotate or a similar app. |
Thanks.....:) This was what I was almost looking for.
|
after reading the suggestion given by the people I decided to write a script and I posted the following question:
http://www.linuxquestions.org/questi...d.php?t=407115 But none of the suggestions worked for me. Neither the script(single find -type ...command) nor the logrotate. Everyone keeps referring to logrotate, but I still don;t get it. Does that mean that for every file in the /var/log directory we will have to write a rule in the logrorate.conf file? Wouldn't that be too much of work to write a rule for every single file. I might as well use the cat /dev/null >> <filename> as many number of time as the file under /var/log directory are. I need some thoughtful suggestion. Thanks |
Not for every file, but for every log type. For example, I have 1 entry in /etc/logrotate.d for each of cups, samba, squid, syslog & vsftpd. Since you can create a new entry from an existing one with cp and edit from there, it's not that much work.
|
Quote:
Suggestions most welcome |
exec logs clear from desktop
Easy bin file to clear any listed logs in the bin file
/root/Desktop/logclear.bin COPY the below into your favorite txt editor save as logclear.bin set permissions to execute user root grp root pick a nice icon for it save to desktop then click it pick RUN IN TERMINAL or from cammand line cd to roots desktop and execute it [root@mail Desktop]# ./logclear.bin [root@mail Desktop]# cat /dev/null > /var/log/messages cat /dev/null > /var/log/openwebmail.log cat /dev/null > /var/log/maillog cat /dev/null > /var/log/secure cat /dev/null > /var/log/httpd/error_log cat /dev/null > /var/log/httpd/ssl_error_log cat /dev/null > /var/log/httpd/ssl_request_log cat /dev/null > /var/log/httpd/ssl_access_log Enjoy |
You can remove all logs file using script on command line
for logs in `find /var/log -type f`; do > $logs; done or save this in to some file like zerolog.sh and chmod +x zerolog.sh execute the script ./zerolog.sh |
All times are GMT -5. The time now is 05:13 AM. |