Operating System - Tru64 Unix
1752808 Members
5582 Online
108789 Solutions
New Discussion юеВ

Re: /var/adm/syslog.dated not being cleared out

 
Howard Anderson_2
Frequent Advisor

/var/adm/syslog.dated not being cleared out

I am running Tru64 5.1B PK5 on DS25 AlphaServers.
I have directed all of my system logs (daemon.log mail.log etc.) to /var/adm/syslog.dated.
On previous systems (4.0D, 4.0G), when a year had gone by, the directory for a particular date had been cleared out for a fresh set of logs. However it now appears that the old logs are still there and are being appended to.
I don't think we had a bespoke script clearing this stuff out, so why is the OS not now clearing it?
Have I missed a config setting somewhere ?
(This is causing testers to raise fault reports on issues which were actually resolved last year. Maximum confusion!)
9 REPLIES 9
Ivan Ferreira
Honored Contributor

Re: /var/adm/syslog.dated not being cleared out

This is on the cron of root on my systems:

40 4 * * * find /var/adm/syslog.dated/* -depth -type d -ctime +7 -exec rm -rf {} \;

Keeps logs for 7 days.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Arch_Muthiah
Honored Contributor

Re: /var/adm/syslog.dated not being cleared out

Howard,

You can delete this file as whenever you want, but this files can be used to trouble shoot your system problems, so better keep them for some time and delete then.

or as per Ivan suggestion, you can schedule this file deletion from cron job in selected interval.

Archunan
Regards
Archie
Harmanjit_1
Frequent Advisor

Re: /var/adm/syslog.dated not being cleared out

As suggested by Ivan, the system should have cron entry to cleanup the syslog.dated logs. You can put the entry mentioned in crontab if its not there.

thanks
Howard Anderson_2
Frequent Advisor

Re: /var/adm/syslog.dated not being cleared out

I have now added a dirclean entry (similar to the find example, but easier to read) to the root crontab on these systems.
I am just surprised that it wasn't there by default. Have I inadvertenly removed a default entry ?
Ivan Ferreira
Honored Contributor

Re: /var/adm/syslog.dated not being cleared out

Yes, because this entry is there by default.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Howard Anderson_2
Frequent Advisor

Re: /var/adm/syslog.dated not being cleared out

Ivan, I have 'find' based entries on my old systems, but I would have expected a 'dirclean' on 5.1B PK5.
Is the entry you described previously on a 5.1B system, and if so was that system fresh installed with 5.1B or was it upgraded, such that it inherited the earlier cron settings ?

(You have solved my isssue, many thanks, I am just curious, as I clean installed one of these systems, and an assoicate did the other one, but both are missing this entry, and I am worried in case somthing else got trashed that I haven't found yet.)
Michael Schulte zur Sur
Honored Contributor

Re: /var/adm/syslog.dated not being cleared out

Howard,

even in a fresh installed 5.1B the syslog will be deleted with find. The find has an option to do a command before entering a dir. It is used to remove old syslog dirs. dirclean may not be able to handle that.

greetings,

Michael
Ivan Ferreira
Honored Contributor

Re: /var/adm/syslog.dated not being cleared out

The entry exists on a new brand installed Tru64 5.1B PK5.

The dirclean utility is less flexible than the find and rm combinations which it is intended to replace. Specifically, there is no way to give dirclean a file exclusion list.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Howard Anderson_2
Frequent Advisor

Re: /var/adm/syslog.dated not being cleared out

Ivan thanks for the confirmation that this entry exists on a brand new install.
I am going to try a quick install on a spare disk later this week, and I will copy the missing entry (or entries), as I want the 'As delivered' configuration for this.
I now have to look at what (or who) may have removed this entry.

I too have read the restrictions section in the dirclean man page, but for this particular use, an exclusion list is not required, and the man page also states that dirclean is quicker and more secure than find.
I don't need it to remove the dirs, just their contents.
A further discussion of which is better is really off-topic.

However as I said, I want the HP default config, (unless they had inadvertently dropped it on 5.1B for some reason, which you have now disproved.)
Many thanks for your help Ivan, and yours too Michael.