Thanks for you interest in Web Server 7.
Yes, Web Server 7 has a rich CLI and
Log rotation like most administration tasks is configurable using the CLI.
To schedule log rotation you need a create an "event" . The event as can be seen from the usage could be restart/reconfig/rotate-log/rotate-access-log etc.
wadm> create-event
Usage: create-event [--echo] [--no-prompt] [--verbose] [--no-enabled] --config=name --command=restart|reconfig|rotate-log|rotate-access-log|update-crl|commandline ( (--time=hh:mm [--month=1-12] [--day-of-week=sun/mon/tue/wed/thu/fri/sat] [--day-of-month=1-31]) | --interval=60-86400(seconds) )
CLI014 config is a required option.
I will walk thru the steps in the CLI starting from scratch..
1. Create a config.
2. Create an event
3. Create an instance of the config
4. Start the instance
5. Deploy the config ( This is a workaround. You should not have to to do this in the upcoming Technology Preview Release 3).
That's it.. The log should be rotated as per the parameters specified when you create the event.
I am pasting below the actual result of following the above steps.
In the example below the event scheduled is a rotate-log event. rotate-log rotates the error log. If you need to rotate the access logs use rotate-access-log instead.
bash-3.00# ./wadm --user admin --port 18911
Please enter admin-user-password>
Sun Java System Web Server 7.0-Technology-Preview-2 B06/19/2006 17:16
wadm> date
Sat Sep 16 09:52:27 IST 2006
wadm> create-config -- --server-name servername --http-port 18923 test
CLI201 Command 'create-config' ran successfully
wadm> create-event --config=test --command=rotate-log --time=09:55
CLI201 Command 'create-event' ran successfully
wadm> list-events --config=test --verbose --all
command timeinterval
rotate-log{09:55}
wadm> create-instance --config=test wspqes032
CLI201 Command 'create-instance' ran successfully
wadm> start-instance --config=test
CLI204 Successfully started the server instance.
wadm> deploy-config test
CLI201 Command 'deploy-config' ran successfully
wadm> date
Sat Sep 16 09:53:22 IST 2006
wadm> pwd
/space/hari/ws7/tpv2/bin
wadm> cd ../https-test/logs
wadm> date
Sat Sep 16 09:53:37 IST 2006
wadm> ls -al
total 8
drwxr-xr-x2 rootroot 512 Sep 16 09:53 .
drwxr-xr-x 10 rootroot 512 Sep 16 09:53 ..
-rw-r--r--1 rootroot 143 Sep 16 09:53 access
-rw-r--r--1 rootroot 683 Sep 16 09:53 errors
wadm> date
Sat Sep 16 09:55:18 IST 2006
wadm> ls -al
total 8
drwxr-xr-x2 rootroot 512 Sep 16 09:55 .
drwxr-xr-x 10 rootroot 512 Sep 16 09:53 ..
-rw-r--r--1 rootroot 143 Sep 16 09:53 access
-rw-r--r--1 rootroot0 Sep 16 09:55 errors
-rw-r--r--1 rootroot 869 Sep 16 09:55 errors.200609160955
wadm>
In this example we have configures the log to be rotated at 09:55 am and as can be seen this has been done.
We appreciate your valuable feedback. Please do mail us at webserver7_ea@sun.com
Hope that helps,
Hari.
Message was edited by:
hari19
Thanks for the detailed response, it works .
But I have another question I was testing this command and used it to create a "rotate-log" event multiple times using time and interval options. This is the output for a list-event command
wadm> create-event --config=Config --command=rotate-log --time=23:00
CLI201 Command 'create-event' ran successfully
wadm> list-events --config=Config --verbose --all
command timeinterval
rotate-log{23:59},{23:00} 86400
Does this mean that the logs will be rotated at 23:00, 23:59 as well as at every 86400 seconds?
Yes, According to my tests that is the behaviour.
Adding multiple rotate-log events means all of the events are executed.
I tried adding two rotate-log events and saw that both of them happened.
I havent tried the interval type of event though. Will check and update.
Regards,
Ha