• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Rotate log script required urgently

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
To get a wish, you need a genie. To get a genie, you need a lamp. To get a lamp, you need a tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic