Logrotate: how to access the output file in postrotate

logrotate

I rotate Nginx logs daily (with dateext). After the rotation I want to parse the file for the day that just passed and compile an email with the number of errors returned by Nginx server.

How can I access the output file in the postrotate / endscript section of logrotate ?

Best Answer

I'm not aware of any variables you can use if that's what you're looking for. However immediately after rotating the log, you should know precisely the name that the file has been rotated to based on the configuration you've set for the rotation (/var/log/somefile.1 or the like).

Perhaps it would be easier to answer if you described actual problem you're trying to solve?