Skip to Content
Red Hat Enterprise Linux Server Cookbook
book

Red Hat Enterprise Linux Server Cookbook

by William Leemans
December 2015
Intermediate to advanced
250 pages
4h 41m
English
Packt Publishing
Content preview from Red Hat Enterprise Linux Server Cookbook

Configuring logrotate

The logrotate tool allows you to rotate the logs that are generated by applications and scripts

It keeps your log directories clutter-free and minimizes disk usage when correctly configured.

How to do it…

The logrotate tool is installed by default, but I will include the installation instructions here for completeness. This recipe will show you how to rotate logs for rsyslog. We will rotate the logs everyday, add an extension based on the date, compress them with a one-day delay, and keep them for 365 days. Perform the following steps:

  1. First, to install logrotate, perform the following command:
    ~]# yum install -y logrotate
    
  2. Ensure that it's enabled through the following:
    ~]# systemctl restart crond
    
  3. Open /etc/logrotate.d/syslog ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

CentOS 7 Server Deployment Cookbook

CentOS 7 Server Deployment Cookbook

Timothy Boronczyk

Publisher Resources

ISBN: 9781784392017