SHARE
Facebook X Pinterest WhatsApp

How to rotate logs manually in Linux?

Written By
thumbnail
Web Webster
Web Webster
Feb 22, 2016

In Linux every activity is monitored and logged in to their respective logs in /var/log folder. The depth of log information is dependent on the log configuration we did it in /etc/logrotate.d and we have to rotate them all the time to control how much space they use. When ever we install packages, the package copies its log configuration file to /etc/logrotate.d folder so that that specific application log files can be rotated.

Normally in any Linux/Unix machine logs are rotated daily(/etc/cron.daily/) or weekly(/etc/cron.weekly) or monthly(/etc/cron.monthly) depending where we kept our logrotate script. My logrotate script is located in /etc/cron.daily which indicate my logs are rotated daily. One more facter logrotate depends when rotatting logs is log “status” file which is located at /var/lib/logrotate/status which stores when we rotated logs last time.

Let us see how we can rotate logs manually instead of waiting for hours.

Example1: In order to check what happens when we rotate log files manually before actually executing them can be done in debug mode(-d).
read full post: http://www.linuxnix.com/how-to-rotate-logs-manually-in-linux/

thumbnail
Web Webster

Web Webster

Web Webster has more than 20 years of writing and editorial experience in the tech sector. He’s written and edited news, demand generation, user-focused, and thought leadership content for business software solutions, consumer tech, and Linux Today, he edits and writes for a portfolio of tech industry news and analysis websites including webopedia.com, and DatabaseJournal.com.

Recommended for you...

Germany Puts Microsoft on Five Years Probation for Antitrust Bullying
brideoflinux
Oct 12, 2024
Linus Torvalds Expresses Frustration With Bcachefs Development Process
Senthil Kumar
Oct 7, 2024
Mozilla Thunderbird Lands On Android With New Beta Release
Senthil Kumar
Oct 1, 2024
Tor and Tails Merge to Fight Global Surveillance and Censorship
Bobby Borisov
Sep 26, 2024
Linux Today Logo

LinuxToday is a trusted, contributor-driven news resource supporting all types of Linux users. Our thriving international community engages with us through social media and frequent content contributions aimed at solving problems ranging from personal computing to enterprise-level IT operations. LinuxToday serves as a home for a community that struggles to find comparable information elsewhere on the web.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.