M
M
MoyMirok2021-08-19 13:43:42
System administration
MoyMirok, 2021-08-19 13:43:42

How to delete a logfile after it is compressed in logrotate?

Hello. Subject.

It is necessary that the compressed file remains (this is understandable), and the old log is deleted, (this is not clear)?
Now the file is being cleared instead of being deleted entirely.

Example

/opt/atlassian/jira/logs/catalina.out
/opt/atlassian/jira/logs/access_log.* {
        daily
        rotate 30
        missingok
        create 644 jira jira
        dateext
        compress
        sharedscripts

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
MoyMirok, 2021-08-19
@MoyMirok

So. Thank you all for your help. I realized the wrong approach. You must first cut off the built-in loggers, and then deal with rotate

A
Alexey Dmitriev, 2021-08-19
@SignFinder

You are confusing something.
Logrotate compresses and deletes the file.
And a new one is created for you by "create 644 jira jira"

L
linux81, 2021-08-19
@linux81

rotate 30
after there are 30 compressed files - the 31st one, the oldest one, will be removed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question