LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   How to clear all kinds of Logs under Debian (https://www.linuxquestions.org/questions/debian-26/how-to-clear-all-kinds-of-logs-under-debian-404616/)

kushalkoolwal 01-17-2006 04:10 PM

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

kushalkoolwal 01-18-2006 02:12 PM

Anyone?????

gilead 01-18-2006 06:14 PM

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...

kushalkoolwal 01-19-2006 03:08 AM

Thanks for the kind help.

divukman 01-19-2006 05:48 AM

I haven't got a clue, but this might be a start. :scratch:

Code:

$ apt-cache search logfiles
grc - generic colouriser for everything
libfile-tail-perl - File::Tail perl module
liblogfile-rotate-perl - Perl module to rotate logfiles.
lire - full-featured log analyzer and report generator
lire-devel-doc - Developer's documentation for Lire 2.0
lire-doc - Documentation for Lire 2.0
radiuscontext - RADIUS log parser and report generator
analog - analyzes logfiles from web servers
apache2-utils - utility programs for webservers
apachetop - Realtime Apache monitoring tool
cron - management of regular background processing
fwanalog - firewall log-file report generator (using analog)
libadns1-bin - Asynchronous-capable DNS client library and utilities
log2mail - Daemon watching logfiles and mailing lines matching patterns
logcheck - mails anomalies in the system logfiles to the administrator
logtail - Print log file lines that have not been read
pisg - Perl IRC Statistics Generator
remstats-servers - Remote Statistics System: remote information servers
xlogmaster - A program to monitor logfiles
xwatch - A logfile monitor that displays in an X window.
multitail - view multiple logfiles windowed on console
prelude-lml - Hybrid Intrusion Detection System [ Log Monitoring Lackey ]
conserver-client - connect to a console server
conserver-server - connect multiple user to a serial console with logging


stress_junkie 01-19-2006 05:53 AM

If you use the logrotate utility then the log files will clear themselves over time.

nx5000 01-19-2006 07:03 AM

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 .
drwxr-xr-x 13 root        root  4096 2006-01-19 14:01 ..
-rw-r-----  1 root        adm      0 2006-01-19 14:01 auth.log
-rw-rw-r--  1 root        utmp    0 2006-01-19 14:01 btmp
drwxr-s---  2 Debian-exim adm  4096 2006-01-19 14:01 exim4
drwxr-xr-x  2 root        root  4096 2006-01-19 14:01 ksymoops
-rw-rw-r--  1 root        utmp 30076 2006-01-19 14:01 lastlog
drwxr-sr-x  2 news        news  4096 2006-01-19 14:01 news
-rw-r-----  1 root        adm      0 2006-01-19 14:01 syslog
-rw-rw-r--  1 root        utmp    0 2006-01-19 14:01 wtmp

Hope it helps..

kushalkoolwal 01-19-2006 04:23 PM

Thank you guys. Well this has definately given me a start.

farslayer 01-20-2006 02:01 PM

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.

kushalkoolwal 01-20-2006 06:22 PM

Thanks.....:) This was what I was almost looking for.

kushalkoolwal 01-25-2006 04:55 PM

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

gilead 01-25-2006 05:09 PM

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.

kushalkoolwal 01-25-2006 05:18 PM

Quote:

Originally Posted by gilead
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.

Thanks for the information. Actually, everynow and then I keep installing various packages, so if I use the logrotate, I would have to go and add entry everytime. A script which just clears out all the log file inside /var/log directory would be the optimum solution in my case.

Suggestions most welcome

digihlp 02-08-2008 11:08 AM

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

basit.engg 08-27-2010 11:58 AM

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.