How to keep a fixed file name for the latest log when error_log and access_log are rotated by rotatelogs in Apache httpd
Issue
- How can I keep a fixed file name for the latest log when
error_log
andaccess_log
are rotated byrotatelogs
? - When I use
rotatelogs
to rotate access_log with the following configuration, all files become the file name with the specified formataccess_log.%Y-%m-%d
(likeaccess_log.2018-10-19
,access_log.2018-10-20
). I would like to keep the latest log file with just the file nameaccess_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.