** There is a depot for logrotate for HPUX available here: HP-UX Porting and Archiving Centre
If you work with Linux, you will eventually learn about logrotate. Logrotate is program that is run via cron that will rotate files, etc. It can also compress files, change permissions, and run other user provided commands. To learn more I would suggest reading the logrotate man page.
But what about UNICES like HP-UX or AIX? They don't come with this nifty binary by default. To get a similar functionality I use Perl-Logrotate. It's essentially a perl script that gives you a logrotate style solution to keeping logs. Basically you run the script via cron. And you keep your configuration info in a file called logrotate.conf. To keep with standards, I usaally put the file under /etc/ and I put the perl script under /sbin. You'll need to edit this line in the script to point to the config file.
And here is a sample config file.
As you can see the layout is similar to that of logrotate. So if you aren't looking to re-invent the wheel and need a way to rotate log files, then Perl-Logrotate might be the solution for you.
If you work with Linux, you will eventually learn about logrotate. Logrotate is program that is run via cron that will rotate files, etc. It can also compress files, change permissions, and run other user provided commands. To learn more I would suggest reading the logrotate man page.
But what about UNICES like HP-UX or AIX? They don't come with this nifty binary by default. To get a similar functionality I use Perl-Logrotate. It's essentially a perl script that gives you a logrotate style solution to keeping logs. Basically you run the script via cron. And you keep your configuration info in a file called logrotate.conf. To keep with standards, I usaally put the file under /etc/ and I put the perl script under /sbin. You'll need to edit this line in the script to point to the config file.
# Configuration file to use.
our $config_file = 'logrotate.conf';
And here is a sample config file.
$ cat /etc/logrotate.conf
## Configuration for logrotate
# Please read logrotate for more information
logfile /var/adm/syslog/syslog.log
rotate-time 1 week
keep-files 2
compress yes
status-file /var/run/logrotate.status
dryrun no
logfile /var/adm/sulog
rotate-time 1 week
keep-files 1
compress yes
status-file /var/run/logrotate.status
dryrun no
logfile /var/adm/sudo.log
rotate-time 1 week
keep-files 1
compress yes
status-file /var/run/logrotate.status
dryrun no
As you can see the layout is similar to that of logrotate. So if you aren't looking to re-invent the wheel and need a way to rotate log files, then Perl-Logrotate might be the solution for you.
I can't speak for AIX, but logrotate runs fine under HP-UX and has for a very long time.
ReplyDeleteHowever, if Perl::Logrotate is truly portable and OS-independent, it would be perfect for OpenVMS logs...
I also noticed that there is no home page for Perl::Logrotate and according to Freshmeat it hasn't been updated since its initial Freshmeat entry in 2005.
ReplyDeleteThere really isn't much to the perl script. I've been using for two years and never had any issues.
ReplyDelete