New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FreeBSD: Logrotate Needs "compresscmd /usr/bin/gzip". #482

Closed
eekay35 opened this Issue Oct 20, 2017 · 8 comments

Comments

Projects
None yet
3 participants
@eekay35

eekay35 commented Oct 20, 2017

Summary

In FreeBSD, the latest version of sysutils/logrotate (3.13.0) is defaulting to using "/bin/gzip" (hard-coded into the binary) which, in turn, produces an error and does not compress the rotated log file.

FreeBSD's "gzip" executable is located in "/usr/bin". So, the "froxlor" logrotate config file that is provided needs to have the "compresscmd /usr/bin/gzip" added to it in order to override the default "gzip" location.

System information

  • Froxlor version: 0.9.38.7 (DB: 201612110)
  • Web server: apache2
  • DNS server: Bind
  • POP/IMAP server: Dovecot
  • SMTP server: postfix
  • FTP server: proftpd
  • OS/Version: FreeBSD 11.0-RELEASE-p10 (amd64)

Steps to reproduce

  1. Get Froxlor configurated with logrotate to handle HTTP logs.
  2. Add suggested logrotate command to crontab (or run manually).
  3. Notice compression error when attempting to rotate and compress old logs.

Expected behavior

  1. Logs would rotate and be compressed using "gzip".

Actual behavior

  1. Logs are not compressed due to location of "gzip" being non-existent.

Log files/log entries

syslog:

rotating log /var/customers/logs/domain.tld-access.log, log->rotateCount is 4                                                                                                                                                                                                                                                 
dateext suffix '-20171019'                                                                                                                                                                                                                                                                                                   
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'                                                                                                                                                                                                                                                                     
compressing log with: /bin/gzip                                                                                                                                                                                                                                                                                              
error: failed to compress log /var/customers/logs/domain.tld-access.log.1                                                                                                                                                                                                                                                     
log /var/customers/logs/domain.tld-access.log.5.gz doesn't exist -- won't try to dispose of it
@eekay35

This comment has been minimized.

Show comment
Hide comment
@eekay35

eekay35 Oct 20, 2017

Whoopsie. I guess I should supply the change that works...

#
# Froxlor logrotate snipet
#
/var/customers/logs/*.log {
  missingok
  weekly
  rotate 4
  compress
  compresscmd /usr/bin/gzip
  delaycompress
  notifempty
  create
  sharedscripts
  postrotate
  /usr/local/etc/rc.d/apache24 reload > /dev/null 2>&1 || true
  endscript
}

eekay35 commented Oct 20, 2017

Whoopsie. I guess I should supply the change that works...

#
# Froxlor logrotate snipet
#
/var/customers/logs/*.log {
  missingok
  weekly
  rotate 4
  compress
  compresscmd /usr/bin/gzip
  delaycompress
  notifempty
  create
  sharedscripts
  postrotate
  /usr/local/etc/rc.d/apache24 reload > /dev/null 2>&1 || true
  endscript
}
@d00p

This comment has been minimized.

Show comment
Hide comment
@d00p

d00p Oct 20, 2017

Member

well, I would change this, but there is no official FreeBSD config-template provided by us ;) So what distro did you chose in your first step of the 'steps to reproduce'?

Member

d00p commented Oct 20, 2017

well, I would change this, but there is no official FreeBSD config-template provided by us ;) So what distro did you chose in your first step of the 'steps to reproduce'?

@eekay35

This comment has been minimized.

Show comment
Hide comment
@eekay35

eekay35 Oct 20, 2017

eekay35 commented Oct 20, 2017

@click0

This comment has been minimized.

Show comment
Hide comment
@click0

click0 Dec 19, 2017

I confirm.

Despite the explicit requirement to use the compressor bzip2.
The code somewhere is hard-code using /bin/gzip.

System informations:
FreeBSD 11.1-STABLE #0 r326554: Tue Dec 5 10:48:47 EET 2017
logrotate-3.13.0 Daemon to rotate, compress, remove, and mail system log files

Snippet config:
/usr/local/etc/logrotate.d/php-fpm.conf

/var/log/php-fpm/*.log /www/*/data/logs/php-fpm-*.error.log {
        weekly
        missingok
        rotate 12
        compress
        delaycompress
        notifempty
        sharedscripts
        postrotate
        endscript
#       noolddir
#        tabooext php-fpm-*
}

Log output:

# /usr/local/sbin/logrotate -fv /usr/local/etc/logrotate.conf
reading config file /usr/local/etc/logrotate.conf
including /usr/local/etc/logrotate.d
reading config file php-fpm.conf
compress_prog is now /usr/bin/bzip2
compress_ext was changed to .bz2
uncompress_prog is now /usr/bin/bunzip2
compress_options is now  -9
compress_ext is now .bz2
Reading state from file: /var/lib/logrotate.status
Allocating hash table for state file, size 64 entries
Creating new state
Creating new state

Handling 1 logs

rotating pattern: /var/log/php-fpm/*.log /www/*/data/logs/php-fpm-*.error.log  forced from command line (12 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/php-fpm/php-fpm.log
  Now: 2017-12-19 06:50
  Last rotated at 2017-12-19 06:42
  log needs rotating
considering log /www/*/data/logs/php-fpm-*.error.log
rotating log /var/log/php-fpm/php-fpm.log, log->rotateCount is 12
dateext suffix '-20171219'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
==>> compressing log with: /bin/gzip
error: failed to compress log /var/log/php-fpm/php-fpm.log.1
log /var/log/php-fpm/php-fpm.log.13.gz doesn't exist -- won't try to dispose of it

click0 commented Dec 19, 2017

I confirm.

Despite the explicit requirement to use the compressor bzip2.
The code somewhere is hard-code using /bin/gzip.

System informations:
FreeBSD 11.1-STABLE #0 r326554: Tue Dec 5 10:48:47 EET 2017
logrotate-3.13.0 Daemon to rotate, compress, remove, and mail system log files

Snippet config:
/usr/local/etc/logrotate.d/php-fpm.conf

/var/log/php-fpm/*.log /www/*/data/logs/php-fpm-*.error.log {
        weekly
        missingok
        rotate 12
        compress
        delaycompress
        notifempty
        sharedscripts
        postrotate
        endscript
#       noolddir
#        tabooext php-fpm-*
}

Log output:

# /usr/local/sbin/logrotate -fv /usr/local/etc/logrotate.conf
reading config file /usr/local/etc/logrotate.conf
including /usr/local/etc/logrotate.d
reading config file php-fpm.conf
compress_prog is now /usr/bin/bzip2
compress_ext was changed to .bz2
uncompress_prog is now /usr/bin/bunzip2
compress_options is now  -9
compress_ext is now .bz2
Reading state from file: /var/lib/logrotate.status
Allocating hash table for state file, size 64 entries
Creating new state
Creating new state

Handling 1 logs

rotating pattern: /var/log/php-fpm/*.log /www/*/data/logs/php-fpm-*.error.log  forced from command line (12 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/php-fpm/php-fpm.log
  Now: 2017-12-19 06:50
  Last rotated at 2017-12-19 06:42
  log needs rotating
considering log /www/*/data/logs/php-fpm-*.error.log
rotating log /var/log/php-fpm/php-fpm.log, log->rotateCount is 12
dateext suffix '-20171219'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
==>> compressing log with: /bin/gzip
error: failed to compress log /var/log/php-fpm/php-fpm.log.1
log /var/log/php-fpm/php-fpm.log.13.gz doesn't exist -- won't try to dispose of it

@click0

This comment has been minimized.

Show comment
Hide comment
@click0

click0 Dec 19, 2017

After creating the symlink to the desired compressor, logrotate has earned as it should.
ln -s /usr/bin/gzip /bin/gzip

click0 commented Dec 19, 2017

After creating the symlink to the desired compressor, logrotate has earned as it should.
ln -s /usr/bin/gzip /bin/gzip

@d00p

This comment has been minimized.

Show comment
Hide comment
@d00p

d00p Dec 19, 2017

Member

again: there's no official freebsd template for this provided by froxlor. You are free to adjust configs to your needs

Member

d00p commented Dec 19, 2017

again: there's no official freebsd template for this provided by froxlor. You are free to adjust configs to your needs

@d00p d00p closed this Dec 19, 2017

@click0

This comment has been minimized.

Show comment
Hide comment
@click0

click0 Dec 19, 2017

again:
There is no 'froxlor' panel on my server.
The config file /usr/local/etc/logrotate.conf says to use a completely different compressor:

...
compresscmd /usr/bin/bzip2
uncompresscmd /usr/bin/bunzip2
compressoptions -9
compressext .bz2

However, when using config snippets in /usr/local/etc/logrotate.d/*.conf for some reason, logrotate tries to use the /bin/gzip compressor.

click0 commented Dec 19, 2017

again:
There is no 'froxlor' panel on my server.
The config file /usr/local/etc/logrotate.conf says to use a completely different compressor:

...
compresscmd /usr/bin/bzip2
uncompresscmd /usr/bin/bunzip2
compressoptions -9
compressext .bz2

However, when using config snippets in /usr/local/etc/logrotate.d/*.conf for some reason, logrotate tries to use the /bin/gzip compressor.

@d00p

This comment has been minimized.

Show comment
Hide comment
@d00p

d00p Dec 19, 2017

Member

No froxlor on your Server but Posting issues Here...great

Member

d00p commented Dec 19, 2017

No froxlor on your Server but Posting issues Here...great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment