If I create a log file... say XXX.log and it's not in the normal spot in the file structure for .log file. (/var/log/) will the logrotate function still work with it?
THANKS!!!
Code: Select all
/var/log/mosquitto/mosquitto.log {
rotate 7
daily
compress
size 100k
nocreate
missingok
postrotate
/usr/bin/killall -HUP mosquitto
endscript
}Code: Select all
/etc/heyu/heyu.log.ttyUSB0 {
rotate 4
weekly
size 100k
compress
delaycompress
missingok
notifempty
}Code: Select all
pi@raspberrypi:/etc/logrotate.d $ sudo logrotate -d --force /etc/logrotate.d/heyu
reading config file /etc/logrotate.d/heyu
error: /etc/logrotate.d/heyu:1 lines must begin with a keyword or a filename (possibly in double quotes)
error: /etc/logrotate.d/heyu:9, unexpected text after }
error: /etc/logrotate.d/heyu:10 lines must begin with a keyword or a filename (possibly in double quotes)
Reading state from file: /var/lib/logrotate/status
Allocating hash table for state file, size 64 entries
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Handling 1 logs
rotating pattern: /etc/heyu/heyu.log.ttyUSB0 forced from command line (4 rotations)
empty log files are not rotated, old logs are removed
considering log /etc/heyu/heyu.log.ttyUSB0
error: skipping "/etc/heyu/heyu.log.ttyUSB0" because parent directory has insecure permissions (It's world writable or w ritable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be use d for rotation.
Creating new state
[ W pi@raspberrypi:/etc/logrotate.d $Code: Select all
pi@raspberrypi:/ $ heyu restart
Config Line 12: Insufficient r/w permission for LOG_DIR directory /var/log/
Quitting due to errors in configuration file '/etc/heyu/x10.conf'
pi@raspberrypi:/ $Code: Select all
pi@raspberrypi:/etc $ sudo chmod 775 heyu
pi@raspberrypi:/etc $ sudo logrotate -d --force /etc/logrotate.d/heyu
reading config file /etc/logrotate.d/heyu
Reading state from file: /var/lib/logrotate/status
Allocating hash table for state file, size 64 entries
Creating new state
Handling 1 logs
rotating pattern: /etc/heyu/heyu.log.ttyUSB0 forced from command line (6 rotations)
empty log files are not rotated, old logs are removed
considering log /etc/heyu/heyu.log.ttyUSB0
Creating new state
Now: 2018-08-23 14:13
Last rotated at 2018-08-23 14:00
log needs rotating
rotating log /etc/heyu/heyu.log.ttyUSB0, log->rotateCount is 6
dateext suffix '-20180823'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
renaming /etc/heyu/heyu.log.ttyUSB0.6.gz to /etc/heyu/heyu.log.ttyUSB0.7.gz (rotatecount 6, logstart 1, i 6),
renaming /etc/heyu/heyu.log.ttyUSB0.5.gz to /etc/heyu/heyu.log.ttyUSB0.6.gz (rotatecount 6, logstart 1, i 5),
renaming /etc/heyu/heyu.log.ttyUSB0.4.gz to /etc/heyu/heyu.log.ttyUSB0.5.gz (rotatecount 6, logstart 1, i 4),
renaming /etc/heyu/heyu.log.ttyUSB0.3.gz to /etc/heyu/heyu.log.ttyUSB0.4.gz (rotatecount 6, logstart 1, i 3),
renaming /etc/heyu/heyu.log.ttyUSB0.2.gz to /etc/heyu/heyu.log.ttyUSB0.3.gz (rotatecount 6, logstart 1, i 2),
renaming /etc/heyu/heyu.log.ttyUSB0.1.gz to /etc/heyu/heyu.log.ttyUSB0.2.gz (rotatecount 6, logstart 1, i 1),
renaming /etc/heyu/heyu.log.ttyUSB0.0.gz to /etc/heyu/heyu.log.ttyUSB0.1.gz (rotatecount 6, logstart 1, i 0),
log /etc/heyu/heyu.log.ttyUSB0.7.gz doesn't exist -- won't try to dispose of it
renaming /etc/heyu/heyu.log.ttyUSB0 to /etc/heyu/heyu.log.ttyUSB0.1
compressing log with: /bin/gzip
pi@raspberrypi:/etc $
Code: Select all
considering log /etc/heyu/heyu.log.ttyUSB0
error: skipping "/etc/heyu/heyu.log.ttyUSB0" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
Creating new state
That msg suggests using a different user for logrotate with the 'su <user> <group>' keywordnpaisnel wrote: ↑Thu Aug 23, 2018 1:21 pmSo back to my earlier question...what next ?
I see this but have no idea what it means or what to do :
Code: Select all
considering log /etc/heyu/heyu.log.ttyUSB0 error: skipping "/etc/heyu/heyu.log.ttyUSB0" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation. Creating new state
Code: Select all
su pi piCode: Select all
/etc/heyu/heyu.log.ttyUSB0 {
su pi pi
rotate 4
weekly
size 100k
compress
delaycompress
missingok
notifempty
}