logrot.pl and logrot_trunc commands

Answered Question
Aug 17th, 2007

None of my RME 3.5 boxes @ IDU 13 running on Solaris have the $NMSROOT/bin/logrot_trunc script.

Can I just:

cp /dev/null filename.log

to zero out the contents of a particular logfile?

I have this problem too.
0 votes
Correct Answer by Joe Clarke about 9 years 3 months ago

It would be helpful to know which files were not zeroed out. There have been a few logrot bugs fixed since the RME 3.5 version, but maybe others exist. The idea with logrot is that dmgtd should not need to be stopped for most log files. To know whether or not a manual truncation on the file will work, you will need to say which logfiles you need to rotate.

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (3 ratings)
Loading.
Joe Clarke Fri, 08/17/2007 - 20:51

I guess I didn't add logrot_trunc until LMS 2.5. You can do "cat /dev/null > logfile" for most log files, but this won't work on, for example, daemons.log. For that, you will need to either use logrot.pl itself, or shutdown dmgtd, zero out the log, then restart dmgtd.

getwithrob Sat, 08/18/2007 - 02:01

I ran logrot.pl -c and configured 5 or 6 of the logfiles.

I indicated I wanted to keep zero copies for of each;

I indicated I wanted the files to be kept at the default size they are now which was I think 30000;

That I wanted the extension to be .Z;

I then ran logrot.pl and only a couple were zero-ed out. I then did a dmgtd stop then ran logrot.pl and still the same results- only a couple of files where zero-ed out. I don't remember which ones they were....

This is why I'm asking if I can just:

cp /dev/null logfile.log or

cat /dev/null logfile.log-

What I could try doing is setting up logrot.pl with only a single log file at a time and see if that will work after stopping dmgtd.

Correct Answer
Joe Clarke Sat, 08/18/2007 - 07:36

It would be helpful to know which files were not zeroed out. There have been a few logrot bugs fixed since the RME 3.5 version, but maybe others exist. The idea with logrot is that dmgtd should not need to be stopped for most log files. To know whether or not a manual truncation on the file will work, you will need to say which logfiles you need to rotate.

getwithrob Sat, 08/18/2007 - 09:09

I'll work on getting them to you next week. Unfortunately I don't have root access to the boxes so I have to work with my hands tied-

getwithrob Mon, 08/20/2007 - 16:21

The Unix admin didn't want to take the time to configure logrot.pl w/ the -c option.

He just wanted to setup a script that read each of the log files from a text then copied /dev/null to each of them.

I'm sorry I was unable to get you a list of which files wouldn't zero out...

Actions

This Discussion