Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

When l look into Ubuntu's System Log Viewer (I think that's the name in English) the messages categories are blown up with 70000 lines and almost 12MB in size. It mixes up messages from May this year and recent messages from the last few days.

How can I remove the old messages from May?

share|improve this question

2 Answers 2

The packages logrotate and rsyslog together will set up your system for automatic archiving and aging the syslog files.

There are plenty of options to the logrotate(8) command that will help you truncate the current mess and then the rest should happen automatically.

share|improve this answer
    
I think that packages are installed by default –  Extender Oct 7 '10 at 7:27
    
Seems that i have a problem with my configuration. i added the following lines to my logrotate.conf /var/log/messages { rotate 1 daily compress create } But when i try to execute sudo logrotate /etc/logrotate.conf i get this error error: /etc/logrotate.conf:31 duplicate log entry for /var/log/messages error: found error in /var/log/messages , skipping What's the reason? –  fmowrg Oct 7 '10 at 11:35
    
@fmowrg As you work through the problem add this information to your original question so it doesn't get lost here in the comments. –  Jorge Castro Oct 8 '10 at 18:18
    
Hi Guys, seemed that there some logfiles crashed, i didn't know what was the exact problem. i experimented with logrotate and rsyslog, but in the end as i anyway planned to make a fresh install of 10.10 i made it this way. –  fmowrg Oct 9 '10 at 13:27

How can I remove the old messages from May?

There are two ways. If it was up to me, I'd determine the importance of the

  1. Shutdown syslog/rsyslog, sudo vi /var/log/messages, and remove the lines from May. Then start up syslog/rsyslog again.
  2. Be patent, and allow `logrotate (8) to rotate the log for you.

@fmowrg :

It sounds like you added some duplicate lines to your logrotate configuration.

The file /var/log/messages (and most files under /var/log) should be rotated by /etc/logrotate.d/syslog (Or a similar file under /etc/logrotate.d/. Do a grep /var/log/messages /etc/logrotate.d/* to be sure).

There should be no need to add /var/log/messages to the file at /etc/logrotate.conf .

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.