February 5, 2009

Log rotation with logadm

Posted in Solaris at 2:35 pm by alessiodini

On a webserver i must rotate the log files . I sometimes used logrotate but i’m looking for something native in Solaris.
I found logadm!

In this case i use it with this options:

logadm -w web -C 30 -o root -g root -m 644  ‘/appl-log/apache/*log’

the options are:

-w web  = creates “web” label and writes the entry on /etc/logadm.conf file
-C 30     = files 30 days old will be deleted
-o root  = every rotated file has root user owner
-g root  = every rotated file has root group owner
-m 644 = rotated file permissions
‘/appl-log/apache/*log’ = all the files that end with log ( access.log , error.log , … )

To force the rotation immediatelly i must run:  logadm -p web now

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: