• k8s-merge-robot's avatar
    Merge pull request #29139 from adityakali/logrotate.1 · 8b16c75b
    k8s-merge-robot authored
    Automatic merge from submit-queue
    
    fix logrotate config (again)
    
    we need to add the dateformat option so that the logrotate
    can create unique logfiles for each rotation. Without this,
    logrotation is skipped with message like (generated in
    verbose mode of logrotate):
    
    rotating log /var/log/rotate-test.log, log->rotateCount is 5
    dateext suffix '-20160718'
    glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
    destination /var/log/rotate-test2.log-20160718.gz already exists, skipping rotation
    
    Tested as follows:
      # config in '/etc/logrotate.d/rotate-test':
      /var/log/rotate-test.log {
        rotate 5
        copytruncate
        missingok
        notifempty
        compress
        maxsize 100M
        daily
        dateext
        dateformat -%Y%m%d-%s
        create 0644 root root
      }
    
      # create 150Mb of /var/log/rotate-test.log
      $ dd if=/dev/zero of=/var/log/rotate-test.log bs=1048576 count=150 conv=notrunc oflag=append
    
      # run logrotate
      $ /usr/sbin/logrotate -v /etc/logrotate.conf
      ...
      rotating pattern: /var/log/rotate-test.log  after 1 days (5 rotations)
      empty log files are not rotated, log files >= 104857600 are rotated earlier, old logs are removed
      considering log /var/log/rotate-test.log
        log needs rotating
      rotating log /var/log/rotate-test.log, log->rotateCount is 5
      Converted ' -%Y%m%d-%s' -> '-%Y%m%d-%s'
      dateext suffix '-20160718-1468875268'
      glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
      copying /var/log/rotate-test.log to /var/log/rotate-test.log-20160718-1468875268
      truncating /var/log/rotate-test.log
      compressing log with: /bin/gzip
    
      Repeating 'dd' and 'logrotate' commands now generate logfiles correctly.
    
    #27754 
    @bprashanth can you please review?
    8b16c75b
Name
Last commit
Last update
.github Loading commit data...
Godeps Loading commit data...
api/swagger-spec Loading commit data...
build Loading commit data...
cluster Loading commit data...
cmd Loading commit data...
contrib Loading commit data...
docs Loading commit data...
examples Loading commit data...
federation Loading commit data...
hack Loading commit data...
hooks Loading commit data...
logo Loading commit data...
pkg Loading commit data...
plugin Loading commit data...
release Loading commit data...
test Loading commit data...
third_party Loading commit data...
vendor Loading commit data...
www Loading commit data...
.generated_docs Loading commit data...
.gitignore Loading commit data...
CHANGELOG.md Loading commit data...
CONTRIB.md Loading commit data...
CONTRIBUTING.md Loading commit data...
DESIGN.md Loading commit data...
LICENSE Loading commit data...
Makefile Loading commit data...
Makefile.generated_files Loading commit data...
README.md Loading commit data...
Vagrantfile Loading commit data...
code-of-conduct.md Loading commit data...