Doesn't 'etc/logrotate.d/tomcat-run.daily' take effect: Manual trigger?

Abstract: Resolve excessive disk usage from large catalina.out files by manually forcing immediate log rotation via the logrotate command.

Created: 2026-10-21 by
You can manually trigger the log rotation for Tomcat by executing the logrotate command with the specific configuration file path and the force flag. This bypasses the scheduled cron job, ensuring that catalina.out is rotated immediately without waiting for the next daily cycle, which is essential for managing disk space during high-traffic periods or after debugging sessions.

Understanding the Log Rotation Mechanism

Tomcat typically writes its console output to the catalina.out file. Unlike standard log files, this file is often not rotated automatically by default configurations because Tomcat keeps the file descriptor open even after the file is moved or truncated. The system relies on logrotate to handle the rotation, but the timing is usually controlled by a cron daemon running once a day. When you encounter a situation where the log file has grown excessively large and you need immediate relief, relying on the scheduler is insufficient. You must intervene directly using the command-line interface provided by the logrotate utility. The configuration file mentioned in your query, etc/logrotate.d/tomcat-run.daily, defines how the rotation should occur. It specifies the target file, the frequency, the number of backups to keep, and the post-rotation script that signals Tomcat to reopen the log file. If this file exists in /etc/logrotate.d/, it is recognized by the global logrotate service. However, simply having the file there does not mean it runs instantly. The manual trigger is required to execute the instructions within that file right now.

Executing the Manual Trigger

To force the rotation, you need to use the terminal. Open your SSH session or local console and navigate to a directory where you have write permissions, though the command itself requires root privileges. The core command involves calling logrotate and pointing it to the specific configuration file. You must also include the --force argument. This argument tells logrotate to rotate the logs regardless of the time criteria defined in the configuration file. Without this flag, logrotate might check the timestamp and decide that no action is needed, leaving your large catalina.out file untouched. The command structure looks like this:
sudo logrotate --force /etc/logrotate.d/tomcat-run.daily
Note that the path in the title etc/logrotate.d/tomcat-run.daily is likely a relative reference or a typo in the original context. The absolute path on most Linux distributions, including Debian and Ubuntu, starts with a slash. Therefore, the correct path is /etc/logrotate.d/tomcat-run.daily. If your configuration file has a different name, such as tomcat or catalina, replace the filename accordingly. Always verify the exact name of the file in the /etc/logrotate.d/ directory before running the command. If the command executes successfully, it will produce no output if everything goes according to plan. If there are errors, such as permission issues or syntax errors in the configuration file, logrotate will print error messages to the standard error stream. It is advisable to run this command with sudo to ensure that the rotation process has the necessary permissions to move, compress, and delete old log files in the Tomcat directory.

Verifying the Rotation

After running the manual trigger, you should verify that the rotation actually occurred. Check the Tomcat logs directory, typically located at $CATALINA_BASE/logs/. You should see that catalina.out has been renamed, possibly to catalina.out.1 or compressed as catalina.out.1.gz, depending on your configuration. A new, empty catalina.out file should be created so that Tomcat can continue writing to it seamlessly. You can also check the system log for any entries related to logrotate. On many systems, these logs are found in /var/log/syslog or /var/log/messages. Look for lines containing logrotate and the name of your configuration file. This provides an audit trail confirming that the manual intervention was processed correctly by the system.

Troubleshooting Common Issues

Sometimes, the manual trigger fails silently or produces unexpected results. One common issue is that the post-rotation script within the logrotate configuration might fail. This script usually sends a signal to the Tomcat process to reopen its log files. If Tomcat does not receive this signal, it may continue writing to the old, rotated file descriptor, causing duplicate logs or confusion about which file contains the current output. To diagnose this, check if the Tomcat process ID (PID) file is accessible and if the kill command in the post-rotate section is valid. Another potential problem is disk space. If the disk is completely full, logrotate cannot create new files or compress old ones. In such cases, you must first free up some space by deleting unnecessary temporary files or old archives before attempting to rotate the active logs. Additionally, ensure that the user running the logrotate command has read and write access to both the configuration file and the log directory. If permissions are too restrictive, the rotation will fail. For users who manage multiple services, it is worth noting that other services might rely on similar logging structures. For instance, if you are setting up complex environments like Geoserver on top of Tomcat, ensuring consistent log management is crucial. You can find more details on setting up robust environments in our guide on Setting up Geoserver with Debian 12 and Tomcat 9: A Tech Support Guide. Similarly, if your Tomcat instance is not starting properly due to service management issues, checking your systemd configuration is vital. Refer to Tomcat runs from the command line, but will not start as a systemd service for troubleshooting startup failures.

Frequently Asked Questions

Why doesn't logrotate rotate catalina.out automatically?

Tomcat keeps the file descriptor open for catalina.out even after the file is rotated. Standard logrotate moves the file, but Tomcat continues writing to the moved file unless a post-rotate script signals it to reopen the new file.

What happens if I forget the --force flag?

If you omit the --force flag, logrotate checks the age of the log file against the schedule defined in the config. If the file is not yet due for rotation based on time, nothing happens, and the large log file remains unchanged.

Can I use logrotate to compress old logs?

Yes, you can add the compress directive to your logrotate configuration file. This instructs logrotate to gzip the rotated log files, saving significant disk space compared to keeping uncompressed copies.

How do I check if logrotate ran successfully?

You can check the system logs in /var/log/syslog for entries from logrotate. Additionally, verify that the new catalina.out file is empty and that older versions exist in the logs directory with the expected naming convention.

Is it safe to rotate logs while Tomcat is running?

Yes, it is safe and recommended to rotate logs while the service is active. The key is ensuring the post-rotate script correctly signals Tomcat to switch file descriptors, preventing data loss or duplication during the transition.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More