• Post Reply Bookmark Topic Watch Topic
  • New Topic

Rotate log script required urgently  RSS feed

 
Sharn Arora
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Can someone please help me write script for below requirement:


Create a process/script that monitors that access file. When it gets close to 2GB automatically rotate the file.
After the logs are rotated, zip them up into the following format:
access.date-time.etcap35.gz
errors.date-time.etcap35.gz

the date-time portion should be formatted like this: 09Nov-0545AM (DDMon-HHMM)
After they have been zipped up, move them to another server named etcap37 into: /opt/webtrends/logs/RawLogs/etcap35-36 dir
(due to the ftp restrictions, you may have to ftp into your local account then have the 'wtrs' account move them to: /opt/webtrends/logs/RawLogs/etcap35-36)
 
Sharn Arora
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry.. forget to mention the server name. We are required to rotate access and log files for iPlanet Web Server.
 
Sharn Arora
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry.. forget to mention the server name. We are required to rotate access and log files for iPlanet Web Server.
 
Joe Ess
Bartender
Posts: 9441
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ease Up. Every question here is "urgent", at least to the person asking it.
As for your problem, I believe it is difficult to truncate a file that is in use by a process. I think your best bet is to dig into the iPlanet documentation and see what your log options are. I have experience with Weblogic and it allows log rotation by size or date. You can then write a separate cron task to move the files.
 
Darrin Cartwright
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy Sharn,

If you're running on Linux, you should check out the built in logrotate functionality. Try typing 'man logrotate' on your system. You can do everything you mentioned above with a config file.

Darrin
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!