LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
Search this Thread
Old 01-17-2006, 05:10 PM   #1
kushalkoolwal
Senior Member
 
Registered: Feb 2004
Location: Middle of nowhere
Distribution: Debian Squeeze
Posts: 1,249

Rep: Reputation: 48
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
 
Old 01-18-2006, 03:12 PM   #2
kushalkoolwal
Senior Member
 
Registered: Feb 2004
Location: Middle of nowhere
Distribution: Debian Squeeze
Posts: 1,249

Original Poster
Rep: Reputation: 48
Anyone?????
 
Old 01-18-2006, 07:14 PM   #3
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,123

Rep: Reputation: 162Reputation: 162
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...
 
Old 01-19-2006, 04:08 AM   #4
kushalkoolwal
Senior Member
 
Registered: Feb 2004
Location: Middle of nowhere
Distribution: Debian Squeeze
Posts: 1,249

Original Poster
Rep: Reputation: 48
Thanks for the kind help.
 
Old 01-19-2006, 06:48 AM   #5
divukman
Member
 
Registered: Sep 2005
Location: Split, Croatia
Distribution: Gentoo/Debian
Posts: 140
Blog Entries: 8

Rep: Reputation: 15
Question

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

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
 
Old 01-19-2006, 06:53 AM   #6
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
If you use the logrotate utility then the log files will clear themselves over time.
 
Old 01-19-2006, 08:03 AM   #7
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 53
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..

Last edited by nx5000; 01-19-2006 at 08:14 AM.
 
Old 01-19-2006, 05:23 PM   #8
kushalkoolwal
Senior Member
 
Registered: Feb 2004
Location: Middle of nowhere
Distribution: Debian Squeeze
Posts: 1,249

Original Poster
Rep: Reputation: 48
Thank you guys. Well this has definately given me a start.
 
Old 01-20-2006, 03:01 PM   #9
farslayer
Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,232
Blog Entries: 5

Rep: Reputation: 189Reputation: 189
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.
 
1 members found this post helpful.
Old 01-20-2006, 07:22 PM   #10
kushalkoolwal
Senior Member
 
Registered: Feb 2004
Location: Middle of nowhere
Distribution: Debian Squeeze
Posts: 1,249

Original Poster
Rep: Reputation: 48
Thanks..... This was what I was almost looking for.
 
Old 01-25-2006, 05:55 PM   #11
kushalkoolwal
Senior Member
 
Registered: Feb 2004
Location: Middle of nowhere
Distribution: Debian Squeeze
Posts: 1,249

Original Poster
Rep: Reputation: 48
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
 
Old 01-25-2006, 06:09 PM   #12
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,123

Rep: Reputation: 162Reputation: 162
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.
 
Old 01-25-2006, 06:18 PM   #13
kushalkoolwal
Senior Member
 
Registered: Feb 2004
Location: Middle of nowhere
Distribution: Debian Squeeze
Posts: 1,249

Original Poster
Rep: Reputation: 48
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
 
Old 02-08-2008, 12:08 PM   #14
digihlp
LQ Newbie
 
Registered: Apr 2002
Location: 33619
Distribution: r5eadhat 7.2
Posts: 6

Rep: Reputation: 0
Smile 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
 
Old 08-27-2010, 12:58 PM   #15
basit.engg
LQ Newbie
 
Registered: Mar 2009
Posts: 2

Rep: Reputation: 0
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tips for PC games of all kinds.... lowpingnoob General 1 07-01-2005 01:31 AM
Fonts looks awful on Debian Linux... how do I make it look good and clear like MS? ExCIA Linux - Newbie 2 05-17-2005 07:39 PM
What kinds of linux should I select? Jason_zwf Red Hat 2 08-07-2004 10:09 AM
Differnt kinds of Linux satusred Linux - Software 6 11-02-2003 05:59 PM
All kinds of problems with SuSE. uploadjoe Linux - Software 1 02-22-2003 08:14 PM


All times are GMT -5. The time now is 08:38 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration