Trouble finding app failure details from rotated logs? That’s where the Logrotate Delaycompress option helps.

Logrotate saves disk space by compressing logs. The option Delaycompress can bring in a time delay in compression.

Today, let’s see how our Support Engineers help our customers manage server logs with Logrotate delaycompress option.

 

What is Logrotate?

Let’s have a walkthrough logrotate before having a deep discussion on delaycompress.

The term “log rotation” refers to the entire process of log file management on a server. This involves recording all application logs, creating new logs, and removal of old logs. Logrotate utility is a log file manager, which makes the log rotation task easy.

Usually, the logrotate configuration file is located at /etc/logrotate.conf.  This utility runs automatically as scheduled on the server.

Each application will have a unique entry under /etc/logrotate.d folder based on which log file rotates. The basic services like Apache, MySQL, SSH all will have separate entries under /etc/logrotate.d folder. To make customization, we tweak these files.

 

What is Delaycompress in Log rotate?

Now, let’s check the delaycompress option in the logrotate configuration. Using Delaycompress, we can keep the recent log file uncompressed until the next rotation cycle.

It is useful when we need to delay the compression of log files. When this option is enabled, the latest log gets compressed only at the next scheduled time.

Thus, in a way, it makes the log files readily available in text form itself.

For instance, an example of a firewall log rotation configuration that uses the Delaycompress option is:

Logrotate_delaycompress

In this, the lfd.log file is configured to rotate weekly and compress the rotated files. The delaycompress option makes the compression to delay till the next rotation of the log file.

Delaycompress parameter would be useful for the application servers which requires writing to the logs continuously and delay compression for a particular amount of time.

In production servers, this option will be useful when we need to troubleshoot any server down issues. It will help us to record every log continuously without missing any important data. Moreover, we can save time by readily checking the available logs too.

 

The downside of Delaycompress and how we handle it?

But, sometimes this delay causes some problems. Let’s see how our Dedicated Engineers deal with it.

Recently, one of our customers approached with an error in his monitoring system “Zabbix“. His Zabbix was giving an alert ‘Free Disk Space Is Less Than 20% On Volume‘.

Our Engineers checked in detail and found that 80% of the disk space was utilized for the server. Some deeper checks revealed that the access log was consuming that much disk space.

Since it was the logs, we checked the logrotate configuration and found that logrotate was scheduled to run daily on our customer’s server with a delaycompress option.

So, we removed delaycompress from the respective file for “access log” located at /etc/logrotate.d. This compressed the file without waiting for the next rotation.

That resolved customers’ trouble with disk space.

[Having trouble with delaycompress in logrotate? – Our Experts are available 24/7.]

 

Conclusion

In short, we discussed in detail on the Logrotate delaycompress option and saw how our Support Engineers deal with delaycompress related queries.



Source link

Author

Write A Comment