How to keep a fixed file name for the latest log when error_log and access_log are rotated by rotatelogs in Apache httpd

Solution Verified - Updated -

Issue

  • How can I keep a fixed file name for the latest log when error_log and access_log are rotated by rotatelogs?
  • When I use rotatelogs to rotate access_log with the following configuration, all files become the file name with the specified format access_log.%Y-%m-%d (like access_log.2018-10-19, access_log.2018-10-20). I would like to keep the latest log file with just the file name access_log for monitoring purpose. How can I achieve this?
CustomLog "|sbin/rotatelogs -l logs/access_log.%Y-%m-%d 86400" combined

Environment

  • Red Hat Enterprise Linux 7
  • Red Hat JBoss Core Services
  • Apache httpd 2.4

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content