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

I thought this could've been a common question, but it has been very difficult
NOTE: originally, I thought the issue was caused by something more complex; I see
I originally asked this question on programmers.stackexchange.com, because I figured the answers would be
I use HTTPS, but want to minimize the risk of someone evil crafting their
I want to build a Python function that calculates, and would like to name
Firstly, this DB question could be a bit DB agnostic, but I am using
I'm writing a small program in Ruby to parse a hand history log from
Here's a work problem I've been attacking diligently for about a week now without
I have a branch which I've merged into master. On the branch, git log
Recently, I made some changes to an iOS app. Nothing special, but it was

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.