Logrotate - Variable needed for postrotate script
by SammyC from LinuxQuestions.org on (#5EH11)
I am using logrotate version 3.18.0 on Kali Linux, Debian kernel 5.3.9-3 and have need to use the rotated filename in a postrotate script. My logrotate configuration file uses the dateyesterday operator rather than a numeric character.
I am trying to determine whether logrotate populates a variable with the rotated filename so I can then use that variable within a postrotate script.
Here's what I envision:
logrotate performs actions on log file asa5510.log, the output file is asa5510.log-20210215.gz. I need to be able to pass filename "asa5510.log-20210215.gz" to a script; for example, if logrotate uses the variable $1 as the rotated filename, I'd use something similar to $RFILE=$1 in my postrotate bash script.
Any help would be greatly appreciated!


I am trying to determine whether logrotate populates a variable with the rotated filename so I can then use that variable within a postrotate script.
Here's what I envision:
logrotate performs actions on log file asa5510.log, the output file is asa5510.log-20210215.gz. I need to be able to pass filename "asa5510.log-20210215.gz" to a script; for example, if logrotate uses the variable $1 as the rotated filename, I'd use something similar to $RFILE=$1 in my postrotate bash script.
Any help would be greatly appreciated!