Free Disk Space Without Losing Zimbra Audit Records

When /opt/zimbra/log approaches capacity, administrators may find that audit.log and its rotated copies account for much of the growth. Reclaim space by identifying the exact files, checking retention, archiving required records, and removing only approved logs. Truncate the active file only as an authorized last step.

For context, the example terminal values in the figures below are illustrative; they are not a real server capture or a report of a test. Zimbra's Daffodil v10 Administrator Guide places local logs under /opt/zimbra/log and says audit.log records user and administrator authentication, failed logins, and administrative activity such as configuration changes. Those entries can matter during incident review and compliance checks.

1. Confirm which filesystem is running out of space

Start with the mount that contains the Zimbra log directory. Run as root or an account allowed to read the filesystem statistics:

df -h /opt/zimbra/log

This reports capacity for the filesystem containing that path. If it has room, investigate the mount actually in trouble before deleting anything.

A root shell checks available space on the filesystem mounted at /opt/zimbra/log; the sample values are illustrative.
The first check reports capacity for the filesystem that stores Zimbra logs.

Also distinguish Zimbra's application audit log from Linux Audit. On Red Hat Enterprise Linux 9, the operating-system audit service normally writes to /var/log/audit/audit.log, a separate path. Clearing that file will not reduce space used by Zimbra's /opt/zimbra/log/audit.log, and the OS audit trail has its own retention controls.

2. Measure the active log and rotated files

Switch to the Zimbra account to inspect the application logs. These read-only commands show matching file sizes and exact names:

su - zimbra
du -sh /opt/zimbra/log/audit.log*
ls -lh /opt/zimbra/log/audit.log*

The unsuffixed audit.log is the active file in this example. Rotated files may use date stamps, numeric suffixes, compression, or another pattern depending on the release and configuration. Treat the listing as authoritative for your host; do not assume every installation names files the same way.

A zimbra shell lists the active audit.log and two compressed rotated files with sample sizes; the values are illustrative.
This size listing helps separate the active audit log from older rotated copies.
A zimbra shell shows the names, owners, and sizes of audit.log and its rotated files; the listing is illustrative.
Confirm the exact filenames and ownership before acting on any rotated log.

3. Check retention before removing old records

Audit entries record authentication and administrator actions. Check retention, incident, and legal-hold requirements first. If a review is underway, preserve the relevant time range and get the record custodian's approval before deleting it.

Inspect the Zimbra account's scheduled jobs and compare them with your local policy:

crontab -l

The Zimbra Daffodil v10 Administrator Guide lists a standard log-pruning job that removes files under /opt/zimbra/log after they are more than eight days old. Other releases and customized hosts may use different jobs or retention. Verify the deployed version and actual crontab; do not shorten retention just to clear an alert.

If an exact rotated file is beyond the approved retention period, first archive it if required. Then remove only that named file, for example:

rm -- /opt/zimbra/log/audit.log.2.gz

Replace the sample name with a path confirmed by ls. Avoid wildcard deletion such as rm audit.log*; it can remove the active file and every retained copy in one command.

4. Archive the records that must be kept

Choose a secured destination on a separate filesystem, with enough capacity and access controls appropriate for sensitive authentication data. Ensure the Zimbra account can write to the protected archive directory. Confirm the mount before writing to it:

df -h /mnt/secure-audit-archive
A root shell checks free space on a separate secure archive mount; the sample values are illustrative.
Verify the archive destination is a different filesystem with enough free space.

The path below is an example only; replace it with your approved archive mount. As the Zimbra account, create a compressed copy and test the gzip stream:

gzip -c /opt/zimbra/log/audit.log > /mnt/secure-audit-archive/audit.log.archive.gz
gzip -t /mnt/secure-audit-archive/audit.log.archive.gz

A successful gzip -t exits without an error message. Confirm the archive exists and has a plausible size. Zimbra may append while the active file is being read, so this copy is not a guaranteed gap-free record of events arriving during the copy. For a complete audit handoff, use a rollover or centralized logging method supported by your installed version. This sample is not a consistent snapshot.

A zimbra shell writes a gzip archive of audit.log to a separate mount and runs gzip -t; the command display is illustrative.
The gzip test checks that the archived file can be read before any source data is cleared.

5. Clear the active file only when policy allows it

If the active log itself is consuming critical space and the records are preserved or no longer subject to retention, an authorized administrator can empty the existing file in place as the Zimbra account:

truncate -s 0 /opt/zimbra/log/audit.log

Truncation leaves the file in place for the logger, but permanently removes its existing bytes. Verify the archive and retention decision first; events written during the copy may not be included. If policy permits no gap or loss, use supported rollover or external collection instead.

A zimbra shell runs truncate -s 0 on the active audit.log; the command display is illustrative.
This is the optional, destructive step for an active log after the archive and retention checks.

6. Verify the cleanup and fresh logging

Check both the active file and the filesystem after the operation:

ls -lh /opt/zimbra/log/audit.log
df -h /opt/zimbra/log

The file should show a reduced size immediately after truncation, and the filesystem should show the reclaimed blocks. If you deleted a rotated file, the same filesystem check confirms whether that deletion freed space. The free-space change may differ from the file size because of filesystem accounting or other activity.

A zimbra shell lists audit.log at zero bytes after truncation; the output is illustrative.
Check the active file size after the authorized truncation.
A zimbra shell checks filesystem capacity after cleanup; the sample values are illustrative.
Compare available space with the earlier df reading to confirm the effect.

Finally, confirm that new audit entries are being written during normal authentication or administration activity, following your change-control process. Do not create repeated failed logins as a test. If space did not increase, verify that you checked the correct mount and that the named files were on it; then look for other large files rather than repeatedly clearing logs. For future incidents, set monitoring and retention rules around the actual Zimbra log path and keep archived audit records access-controlled.

References: Zimbra Daffodil v10 Administrator Guide: Viewing Log Files and Zimbra crontab; Zimbra Collaboration Operational Best Practices: log retention (the page is marked as work in progress); Red Hat Enterprise Linux 9: Understanding Audit log files.

Leave a Comment

How to