LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-10-2007, 07:56 AM   #1
Hyakutake
Member
 
Registered: Apr 2004
Location: Portugal
Distribution: Slackware
Posts: 154

Rep: Reputation: 19
[/var/log] what can I erase here?


Hello everyone.

Is it ok to delete the files in var/log? Some of them are 100megs over.

Thanks.
 
Old 02-10-2007, 08:06 AM   #2
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
It should be completely safe to erase all files under /var/log but if you happen to have some program that creates log files there and for some reason goes crazy if no existing file is present (should not be so), you could just as well clear the files instead of removing:
Code:
echo "" > /var/log/syslog
(for example like that)

But like I said, it should be ok to remove them too. It's a different matter if you happen to need the logfiles afterwards, but surely if they're as big as 100M/file, they have quite a lot of (oldish) information inside and if you feel you don't need them, go ahead and remove Or if you feel troubled, move everything under /var/log/ off to some other directory, and if everything still works after that (i.e. after a day or two), remove the contents you moved away. Basically if a logfile doesn't exist, logger should just create it. I myself remove logfiles from time to time if there's nothing interesting in them, and there's no use to have them (at least on the root partition; maybe at some backup location, if needed later?) wasting space more than is really needed. It's very useful to have logfiles over some period of time, in case you face troubles (then you're able to compare the logs to see what is going wrong), but definitely there's no use having too old information there at your /var. If you have an external disc you store backup data, maybe move the logs there and next time you face this situation, remove old logs and move newer ones there again etc..that way you have logs over a good period of time without having to waste precious disk space.
 
Old 02-10-2007, 09:55 AM   #3
Hyakutake
Member
 
Registered: Apr 2004
Location: Portugal
Distribution: Slackware
Posts: 154

Original Poster
Rep: Reputation: 19
Thanks for your reply b0uncer.

I've moved them to another place, int 3, 4 days, if nothing goes wrong, they are gone.
 
Old 02-10-2007, 10:02 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
It should be completely safe to erase all files under /var/log but
Use logrotate instead of wasting time with trial and error?
 
Old 02-10-2007, 04:43 PM   #5
rigelan
Member
 
Registered: Jul 2005
Location: Iowa
Distribution: Slackware
Posts: 180

Rep: Reputation: 19
Yeah, look up LOGROTATE. I have syslog moved to syslog.1 and syslog.1 moved to syslog.2 every week. Once it hits syslog.4 it is deleted. That way I have nothing over a month old in the var/log.

The config file is /etc/logrotate.conf

Actually, interesting thing about logrotate. It's default is set to switch the logs at 3 in the morning or so. My computer is never on at that time, so I always have it check to see if they need rotated at bootup.

Last edited by rigelan; 02-10-2007 at 04:47 PM.
 
Old 02-10-2007, 05:47 PM   #6
Hyakutake
Member
 
Registered: Apr 2004
Location: Portugal
Distribution: Slackware
Posts: 154

Original Poster
Rep: Reputation: 19
I think logrotate is already installed in 11. But I dont think it is working .

In /var/log there was some .1 .2 .3 .4 files. Does that means logrotate is working?

BTW: its seems that every thing is working fine after remove files.
 
Old 02-10-2007, 06:49 PM   #7
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Actually, interesting thing about logrotate. It's default is set to switch the logs at 3 in the morning or so.
No, that's not logrotate but cron. If you choose Vixie crond you'll have nifty shortcuts like "onboot" which, as the name suggests, runs entries you want when you boot the box. If you, for some obscure reason, don't favour Vixie the look into Anacron.


In /var/log there was some .1 .2 .3 .4 files.
Yes, that's logrotate w/o the compression setting.
 
Old 02-10-2007, 07:04 PM   #8
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
now, uhhh, can't you just put things you wanna run on boot in '/etc/rc.d/rc.local' ?
 
Old 02-10-2007, 07:38 PM   #9
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by H_TeXMeX_H
now, uhhh, can't you just put things you wanna run on boot in '/etc/rc.d/rc.local' ?
Theoretically: yes.
Practically: in case of log-file deletion, no. Because
rc.local is the last thing that runs before logins become
allowed/possible; but for logrotate it would work, it's
just that all process that would be writing to logs will
need to be HUPed right after they started



Cheers,
Tink
 
Old 02-10-2007, 07:53 PM   #10
rickh
Senior Member
 
Registered: May 2004
Location: Albuquerque, NM USA
Distribution: Debian-Lenny/Sid 32/64 Desktop: Generic AMD64-EVGA 680i Laptop: Generic Intel SIS-AC97
Posts: 4,250

Rep: Reputation: 62
Quote:
The config file is /etc/logrotate.conf
Quote:
In /var/log there was some .1 .2 .3 .4 files.
Quote:
Yes, that's logrotate w/o the compression setting.
Found the thread interesting and informative, so I took a look at my own system. Obviously, Debian sets this thing up to run automatically, because I sure never initialized it.

From /var/log/ :
Code:
syslog.0      vsftpd.log      aptitude
syslog.1.gz   vsftpd.log.1    aptitude.1.gz
syslog.2.gz   vsftpd.log.2    aptitude.2.gz
syslog.3.gz   vsftpd.log.3    aptitude.3.gz
syslog.4.gz   vsftpd.log.4    aptitude.4.gz
syslog.5.gz                   aptitude.5.gz
syslog.6.gz
There are lots more, of course, but this sample shows the variable treatment received by the different logs. "syslog" gets 6 generations saved with compression; "aptitude" gets 5; "vsftpd" gets only 4, and no compression.

There must be more to how this works than the information that can be seen in /etc/logrotate.conf

This seems to be the applicable lines from there:
Code:
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# uncomment this if you want your log files compressed
#compress
Even though the "compress" line is commented, most of my generational logs are compressed.

I'm not really looking for a solution since I don't consider the way logs are being handled a problem, but a brief explanation of why they are handled differently would be gratifying.
 
Old 02-10-2007, 08:56 PM   #11
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Obviously, Debian sets this thing up to run automatically
I'd think most distro's would do that by now?..


I don't consider the way logs are being handled a problem,
Say that again after Apache is mysteriously dying on you and you don't know why ;-p


but a brief explanation of why they are handled differently would be gratifying.
The "why" part starts by looking in /etc/logrotate.d. You'll see per-daemon logs and syslogs grouped since they are opened by one single daemon. As for using no compression IIRC that's the shipped defaults. Why it's that way is beyond me. It's one of those post-install things to correct. * As far as there's any "fun with logrotate" to be had, look for pre and postrotate clauses: you can for instance strip stuff out of logs or run a parser before you rotate or send alerts after rotation. Come in handy wrt reporting and such.
 
  


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
weird stuff in /var/log/auth.log bschiett Linux - Security 3 03-12-2005 08:29 AM
Deleted /var/log/messages, can't log any files-iptables chingyenccy Linux - Newbie 7 02-27-2005 04:03 PM
Strange results in /var/log/apache/access.log subt13 Linux - Security 2 08-03-2004 01:21 PM
pppd logging to /var/log/ppp.log problem mrtwice Linux - Software 1 01-10-2004 05:38 PM
iptables, changing log file from /var/log/messages acid2000 Linux - Networking 3 03-11-2003 08:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:24 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration