LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-18-2004, 11:38 AM   #1
sopiaz57
Member
 
Registered: Apr 2003
Distribution: RH 8
Posts: 246

Rep: Reputation: 30
size of logs


how can i run a command that will tell me how large in bytes all my log fies are.

so for example, this command reads all the files, i need to pipe it to something to count the sizes.

# ls -laR | ????

thanks in advance
 
Old 02-18-2004, 11:46 AM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Just cd into the directory and run the ls -al command.. which should give the full size of each file in the output unless you wanted something totally different.
 
Old 02-18-2004, 11:48 AM   #3
DrOzz
Senior Member
 
Registered: May 2003
Location: Sydney, Nova Scotia, Canada
Distribution: slackware
Posts: 4,185

Rep: Reputation: 60
you should just use the du command such as :
du /var/log
or in human readable numbers
du -h /var/log

or use it on specific files such as :
du -h /var/log/maillog*

and with the command your using you can pipe it to less such as :
ls -laR | less
and the first line to the left will show the total amount in size ...
or again you can use "h" such as :
ls -laRh | less to get it in "human readabe" numbers (MB) ...
so instead of seeing lets say :
1176K
you will see
1.2MB when using -h
 
Old 02-18-2004, 11:52 AM   #4
sopiaz57
Member
 
Registered: Apr 2003
Distribution: RH 8
Posts: 246

Original Poster
Rep: Reputation: 30
thanks man, that helped a lot. Does anyone know why my lastlog is so huge? It's 18 mb! I can see from other threads what others have done


http://linuxquestions.org/questions/...t=lastlog+size


is there a way to repair it...because the du command shows it's not very large at all, only like 48 k or something

Last edited by sopiaz57; 02-18-2004 at 12:06 PM.
 
Old 02-18-2004, 12:16 PM   #5
DrOzz
Senior Member
 
Registered: May 2003
Location: Sydney, Nova Scotia, Canada
Distribution: slackware
Posts: 4,185

Rep: Reputation: 60
ok lemme get something straight... you say its 18megs, but du tells you its 48K ???
whats it gonna be ?
anyways just to resolve ... just truncate the file by typing :
> /var/log/lastlog

and it being that size has something to do with sparse files ...
you can read the cp man pages, or do a google search for "sparse files" to read up more about it ...
 
Old 02-18-2004, 12:33 PM   #6
sopiaz57
Member
 
Registered: Apr 2003
Distribution: RH 8
Posts: 246

Original Poster
Rep: Reputation: 30
check it out:


[root@host log]# ls -lah lastlog
-rwxr--r-- 1 root root 18M Feb 18 12:24 lastlog
[root@host log]# du -h lastlog
48K lastlog
[root@host log]#

Im reading up on sparse files, to me they seem to just be like a swap file. Is this accurate?

thanks for the help

ps. is it save to just truncate that file, i dont have to stop syslogd or anything?

Last edited by sopiaz57; 02-18-2004 at 12:52 PM.
 
Old 02-18-2004, 01:12 PM   #7
brentos
Member
 
Registered: Nov 2003
Distribution: Fedora Core3, RHEL3,4
Posts: 92

Rep: Reputation: 15
I am not to sure about du since I have never used it, but I would not be worried about a log file that is 18M thats not to big at all and as a matter of fact its the exact same size as the last log on one of my RH 9 machinces.

Besides most logs only have problems when they get to be around 2 gigs, like apache logs and what not.

So don't worry your last log is normal.
 
Old 02-18-2004, 02:46 PM   #8
DrOzz
Senior Member
 
Registered: May 2003
Location: Sydney, Nova Scotia, Canada
Distribution: slackware
Posts: 4,185

Rep: Reputation: 60
well although 18MB isn't overly a huge amount, it is for some logs ....
but the thing is, if you are reaallllly hurting for some harddrive space then you can truncate the file with the command i shown above ....
 
Old 05-24-2006, 01:14 PM   #9
vancel35
LQ Newbie
 
Registered: May 2006
Posts: 2

Rep: Reputation: 0
After searching the forums, I came across this thread. I read that clearing the lastlog file won't hurt anything, but there is a slight difference in my lastlog size that has me curious.

The server has a 20G drive, but the lastlog file reports as 1.2T. I tried to run logrotate on it, and as it copied data, it filled the drive. How does it get real data from a file that is obviously reporting an incorrect size?

I ended up deleting the attempted backup of lastlog and read up on exactly what lastlog does in these forums and the man page, but I'm still boggled at how the file reports larger than the drive.

Is the system that controls lastlog faulty / buggy? (is it ripe for an attack of some sort?)
How does /var/log/lastlog differ from /var/log/secure?

Thanks
Laura


I apologize if I should've started a new thread, but the thread titled "read this before you post in this forum" seemed to make it perfectly clear that if you're furthering an existing conversation, to add to existing threads and only as a last resort start your own.
 
Old 05-31-2006, 08:50 AM   #10
sopiaz57
Member
 
Registered: Apr 2003
Distribution: RH 8
Posts: 246

Original Poster
Rep: Reputation: 30
How does /var/log/lastlog differ from /var/log/secure? Secure is a logfile where you will find sudo logins, ssh logins, failed and successful root logins.

if you reboot does your lastlog flush?
 
Old 05-31-2006, 09:13 AM   #11
sopiaz57
Member
 
Registered: Apr 2003
Distribution: RH 8
Posts: 246

Original Poster
Rep: Reputation: 30
How does /var/log/lastlog differ from /var/log/secure? Secure is a logfile where you will find sudo logins, ssh logins, failed and successful root logins.

if you reboot does your lastlog flush?
 
Old 05-31-2006, 09:17 AM   #12
cs-cam
Senior Member
 
Registered: May 2004
Location: Australia
Distribution: Gentoo
Posts: 3,545

Rep: Reputation: 57
My log is huge.

Okay thanks guys you've been great, I'll be here all week.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Firefox logs user out? Where are error logs? case1984 Linux - General 0 10-09-2004 02:22 PM
Apache piped logs - split-logfile - zero size files alex_fittyfives Linux - Enterprise 0 08-26-2004 07:04 AM
limit the size of logs ykpaiha Mandriva 2 06-27-2004 11:01 AM
Squid: how to preload cached objects & can restrict size of logs? dravya Linux - General 0 06-04-2004 09:23 AM
Separate firewall logs and general logs dominant Linux - General 3 04-20-2004 01:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:13 PM.

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