Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4031674
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:37:35+00:00 2026-05-20T11:37:35+00:00

Originally I thought log rotation would be easy with the perl’s module Logfile:Rotate, but

  • 0

Originally I thought log rotation would be easy with the perl’s module Logfile:Rotate, but now the requirement changed to appending the date to the filename of the log file.

I need to:

  1. Append the filename rotated (daily) with date.
  2. Zip the log files older than 10 days.
  3. Delete log files older than 30 days.
  4. Logs to be rotated in a directory (i.e. ../logs)

I tried Python’s logging.handlers.TimedRotatingFileHandler, but it creates new empty log files on cron execution. I think it’s meant for a process that’s continuous and not per interval cron execution.

I’m open to any programming (scripting) language for easy log rotation.
Anyone got better ideas?

Not meant to ask for code. Just suggestions.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T11:37:36+00:00Added an answer on May 20, 2026 at 11:37 am

    logrotate utility on most of *nix distros available today support following options of your interest:

     compress
              Old versions of log files are compressed with gzip by default. See also nocompress.
    
     dateext
              Archive old versions of log files adding a daily extension like YYYYMMDD instead of simply adding a number.
    
     olddir directory
              Logs are moved into directory for rotation. The directory must be on the same physical device as the log file being
              rotated, and is assumed to be relative to the directory holding the log file unless an absolute path name is speci-
              fied.  When  this  option is used all old versions of the log end up in directory.  This option may be overriden by
              the noolddir option.
    
     notifempty
              Do not rotate the log if it is empty (this overrides the ifempty option).
    
     postrotate/endscript
              The lines between postrotate and endscript (both of which must appear on lines by themselves)  are  executed  after
              the  log file is rotated. These directives may only appear inside of a log file definition.  See prerotate as well.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Originally I thought to ask if there would be an easy way to provide
This originally was a problem I ran into at work, but is now something
I originally had an array[1..1000] that was defined as a global variable. But now
I originally asked this question on RefactorMyCode , but got no responses there... Basically
I originally asked this question , but in finding an answer, discovered that my
(function() { //do stuff })(); EDIT: I originally thought this construct was called a
I originally asked this question on programmers.stackexchange.com, because I figured the answers would be
Originally I though I'll just take a screenshot of my app on the iPhone
Originally there was the DAL object which my BO's called for info and then
Note: Originally this question was asked for PostgreSQL, however, the answer applies to almost

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.