#959773 logrotate: global options do not affect preceding

Package:
logrotate
Source:
logrotate
Description:
Log rotation utility
Submitter:
Stanislav Sukholet
Date:
2021-09-28 15:57:14 UTC
Severity:
normal
Tags:
#959773#5
Date:
2020-05-05 07:58:48 UTC
From:
To:
Dear Maintainer,

*** Reporter, please consider answering these questions, where appropriate ***

   * What led up to the situation?
I want to change compressor for logrotate to xz

   * What exactly did you do (or not do) that was effective (or
     ineffective)?

So I've added to /etc/logrotate.conf following configuration:
===
# grep compress /etc/logrotate.conf
compress
compresscmd /usr/bin/xz
uncompresscmd /usr/bin/unxz
compressext .xz
compressoptions "--memlimit=150MiB --threads=0"
====
   * What was the outcome of this action?
===
logrotate  always using gzip when running in debug mode:
# logrotate --debug /etc/logrotate.conf
[...]
compress_prog is now /usr/bin/xz
compress_ext was changed to .xz
uncompress_prog is now /usr/bin/unxz
compress_ext is now .xz
compress_options is now  "--memlimit=150MiB --threads=0"
Reading state from file: /var/lib/logrotate/status
[...]
rotating log /var/log/daemon.log, log->rotateCount is 0
dateext suffix '-20200504'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
compressing log with: /bin/gzip
renaming /var/log/daemon.log.1.gz to /var/log/daemon.log.2.gz (rotatecount 1, logstart 1, i 1),
renaming /var/log/daemon.log.0.gz to /var/log/daemon.log.1.gz (rotatecount 1, logstart 1, i 0),
renaming /var/log/daemon.log to /var/log/daemon.log.1
disposeName will be /var/log/daemon.log.1.gz

   * What outcome did you expect instead?
I was sure that logrotate will change archive extension to .xz and archiver command to /usr/bin/xz, as in config file.


*** End of the template - remove these template lines ***

#959773#10
Date:
2020-05-05 09:22:55 UTC
From:
To:
Hi,

thanks for reporting.
Are you specifying the global compression options in
/etc/logrotate.conf after the `include /etc/logrotate.d` line?
In this case I am able to reproduce the issue.
Can you please try to define them before this line.

Probably the default configuration file should note this behavior.


Best regards,
     Christian Göttsche

#959773#15
Date:
2020-05-05 09:39:30 UTC
From:
To:
hi

yes, the compressing options are right after «include» directive:
———————————/etc/logrotate.conf————————————
# packages drop log rotation information into this directory
include /etc/logrotate.d

# system-specific logs may be also be configured here.

monthly
rotate 100
start 0
dateext
compress
compresscmd /usr/bin/xz
uncompresscmd /usr/bin/unxz
compressext .xz
compressoptions "--memlimit=150MiB --threads=0"



——————————————————————

—
Sincerely yours,
Stanislav Sukholet

#959773#20
Date:
2020-05-05 09:44:49 UTC
From:
To:
And yes, moving «include /etc/logrotate.d» directive to the bottom of config resolves this issue.


Afraid, it should be fixed.



—
Sincerely yours,
Stanislav Sukholet

#959773#25
Date:
2020-06-18 15:15:53 UTC
From:
To:
Marking as wontfix as the fact that global options do not affect
preceding include directives is intended.
The documentation got improved via
https://github.com/logrotate/logrotate/pull/325

#959773#34
Date:
2020-06-18 15:15:53 UTC
From:
To:
Marking as wontfix as the fact that global options do not affect
preceding include directives is intended.
The documentation got improved via
https://github.com/logrotate/logrotate/pull/325