Daily compress log files not working

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
1
down vote

favorite
1












This is the log file I am using to compress log files on a daily basis.



/home/ubuntu/logs/server.log 
daily
missingok
rotate 1
compress
create
dateext
dateyesterday
dateformat .%Y-%m-%d
extension .gz
postrotate
mv /home/ubuntu/logs/*.gz /home/ubuntu/zip/
endscript



When I run with the --force option, I don't see the zipped file. I can see only the date extension applied to the file. Here is the result of running the command



logrotate /home/ubuntu/conf/logrotate.conf --state /home/ubuntu/conf/logrotate.state --verbose --force


Result:



rotating pattern: /home/ubuntu/logs/server.log forced from command line (1 rotations)
empty log files are rotated, old logs are removed
considering log /home/ubuntu/logs/server.log
log needs rotating
rotating log /home/ubuntu/logs/server.log, log->rotateCount is 1
Converted ' .%Y-%m-%d' -> '.%Y-%m-%d'
dateext suffix '.2018-03-04'
glob pattern '.[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]'
glob finding old rotated logs failed
renaming /home/ubuntu/logs/server.log to /home/ubuntu/logs/server.log.2018-03-04
creating new /home/ubuntu/logs/server.log mode = 0664 uid = 1000 gid = 1000
running postrotate script
mv: cannot stat '/home/ubuntu/logs/*.gz': No such file or directory
error: error running non-shared postrotate script for /home/ubuntu/logs/server.log of '/home/ubuntu/logs/server.log '


How do I ensure that the log file created yesterday is zipped off and a new, empty one is created for today?










share|improve this question























  • If you want to move rotated logs to a different directory, there's the olddir option.
    – muru
    Mar 6 at 4:16










  • I want to zip and move it to a different directory. For now, I am not even able to get the log files zipped on a daily basis.
    – cogitoergosum
    Mar 6 at 4:17










  • For now, try getting it moved first.
    – muru
    Mar 6 at 4:18










  • I can see it moved with the olddir command. Now use postrotate to compress?
    – cogitoergosum
    Mar 6 at 4:31






  • 1




    The manpage of logrotate.conf says that the postrotate script is run before the rotated file is compressed. It's possible that compress did not work in your earlier attempt because the postrotate script failed.
    – muru
    Mar 6 at 4:33














up vote
1
down vote

favorite
1












This is the log file I am using to compress log files on a daily basis.



/home/ubuntu/logs/server.log 
daily
missingok
rotate 1
compress
create
dateext
dateyesterday
dateformat .%Y-%m-%d
extension .gz
postrotate
mv /home/ubuntu/logs/*.gz /home/ubuntu/zip/
endscript



When I run with the --force option, I don't see the zipped file. I can see only the date extension applied to the file. Here is the result of running the command



logrotate /home/ubuntu/conf/logrotate.conf --state /home/ubuntu/conf/logrotate.state --verbose --force


Result:



rotating pattern: /home/ubuntu/logs/server.log forced from command line (1 rotations)
empty log files are rotated, old logs are removed
considering log /home/ubuntu/logs/server.log
log needs rotating
rotating log /home/ubuntu/logs/server.log, log->rotateCount is 1
Converted ' .%Y-%m-%d' -> '.%Y-%m-%d'
dateext suffix '.2018-03-04'
glob pattern '.[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]'
glob finding old rotated logs failed
renaming /home/ubuntu/logs/server.log to /home/ubuntu/logs/server.log.2018-03-04
creating new /home/ubuntu/logs/server.log mode = 0664 uid = 1000 gid = 1000
running postrotate script
mv: cannot stat '/home/ubuntu/logs/*.gz': No such file or directory
error: error running non-shared postrotate script for /home/ubuntu/logs/server.log of '/home/ubuntu/logs/server.log '


How do I ensure that the log file created yesterday is zipped off and a new, empty one is created for today?










share|improve this question























  • If you want to move rotated logs to a different directory, there's the olddir option.
    – muru
    Mar 6 at 4:16










  • I want to zip and move it to a different directory. For now, I am not even able to get the log files zipped on a daily basis.
    – cogitoergosum
    Mar 6 at 4:17










  • For now, try getting it moved first.
    – muru
    Mar 6 at 4:18










  • I can see it moved with the olddir command. Now use postrotate to compress?
    – cogitoergosum
    Mar 6 at 4:31






  • 1




    The manpage of logrotate.conf says that the postrotate script is run before the rotated file is compressed. It's possible that compress did not work in your earlier attempt because the postrotate script failed.
    – muru
    Mar 6 at 4:33












up vote
1
down vote

favorite
1









up vote
1
down vote

favorite
1






1





This is the log file I am using to compress log files on a daily basis.



/home/ubuntu/logs/server.log 
daily
missingok
rotate 1
compress
create
dateext
dateyesterday
dateformat .%Y-%m-%d
extension .gz
postrotate
mv /home/ubuntu/logs/*.gz /home/ubuntu/zip/
endscript



When I run with the --force option, I don't see the zipped file. I can see only the date extension applied to the file. Here is the result of running the command



logrotate /home/ubuntu/conf/logrotate.conf --state /home/ubuntu/conf/logrotate.state --verbose --force


Result:



rotating pattern: /home/ubuntu/logs/server.log forced from command line (1 rotations)
empty log files are rotated, old logs are removed
considering log /home/ubuntu/logs/server.log
log needs rotating
rotating log /home/ubuntu/logs/server.log, log->rotateCount is 1
Converted ' .%Y-%m-%d' -> '.%Y-%m-%d'
dateext suffix '.2018-03-04'
glob pattern '.[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]'
glob finding old rotated logs failed
renaming /home/ubuntu/logs/server.log to /home/ubuntu/logs/server.log.2018-03-04
creating new /home/ubuntu/logs/server.log mode = 0664 uid = 1000 gid = 1000
running postrotate script
mv: cannot stat '/home/ubuntu/logs/*.gz': No such file or directory
error: error running non-shared postrotate script for /home/ubuntu/logs/server.log of '/home/ubuntu/logs/server.log '


How do I ensure that the log file created yesterday is zipped off and a new, empty one is created for today?










share|improve this question















This is the log file I am using to compress log files on a daily basis.



/home/ubuntu/logs/server.log 
daily
missingok
rotate 1
compress
create
dateext
dateyesterday
dateformat .%Y-%m-%d
extension .gz
postrotate
mv /home/ubuntu/logs/*.gz /home/ubuntu/zip/
endscript



When I run with the --force option, I don't see the zipped file. I can see only the date extension applied to the file. Here is the result of running the command



logrotate /home/ubuntu/conf/logrotate.conf --state /home/ubuntu/conf/logrotate.state --verbose --force


Result:



rotating pattern: /home/ubuntu/logs/server.log forced from command line (1 rotations)
empty log files are rotated, old logs are removed
considering log /home/ubuntu/logs/server.log
log needs rotating
rotating log /home/ubuntu/logs/server.log, log->rotateCount is 1
Converted ' .%Y-%m-%d' -> '.%Y-%m-%d'
dateext suffix '.2018-03-04'
glob pattern '.[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]'
glob finding old rotated logs failed
renaming /home/ubuntu/logs/server.log to /home/ubuntu/logs/server.log.2018-03-04
creating new /home/ubuntu/logs/server.log mode = 0664 uid = 1000 gid = 1000
running postrotate script
mv: cannot stat '/home/ubuntu/logs/*.gz': No such file or directory
error: error running non-shared postrotate script for /home/ubuntu/logs/server.log of '/home/ubuntu/logs/server.log '


How do I ensure that the log file created yesterday is zipped off and a new, empty one is created for today?







cron logging logrotate






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 5 at 22:37

























asked Mar 5 at 16:31









cogitoergosum

1086




1086











  • If you want to move rotated logs to a different directory, there's the olddir option.
    – muru
    Mar 6 at 4:16










  • I want to zip and move it to a different directory. For now, I am not even able to get the log files zipped on a daily basis.
    – cogitoergosum
    Mar 6 at 4:17










  • For now, try getting it moved first.
    – muru
    Mar 6 at 4:18










  • I can see it moved with the olddir command. Now use postrotate to compress?
    – cogitoergosum
    Mar 6 at 4:31






  • 1




    The manpage of logrotate.conf says that the postrotate script is run before the rotated file is compressed. It's possible that compress did not work in your earlier attempt because the postrotate script failed.
    – muru
    Mar 6 at 4:33
















  • If you want to move rotated logs to a different directory, there's the olddir option.
    – muru
    Mar 6 at 4:16










  • I want to zip and move it to a different directory. For now, I am not even able to get the log files zipped on a daily basis.
    – cogitoergosum
    Mar 6 at 4:17










  • For now, try getting it moved first.
    – muru
    Mar 6 at 4:18










  • I can see it moved with the olddir command. Now use postrotate to compress?
    – cogitoergosum
    Mar 6 at 4:31






  • 1




    The manpage of logrotate.conf says that the postrotate script is run before the rotated file is compressed. It's possible that compress did not work in your earlier attempt because the postrotate script failed.
    – muru
    Mar 6 at 4:33















If you want to move rotated logs to a different directory, there's the olddir option.
– muru
Mar 6 at 4:16




If you want to move rotated logs to a different directory, there's the olddir option.
– muru
Mar 6 at 4:16












I want to zip and move it to a different directory. For now, I am not even able to get the log files zipped on a daily basis.
– cogitoergosum
Mar 6 at 4:17




I want to zip and move it to a different directory. For now, I am not even able to get the log files zipped on a daily basis.
– cogitoergosum
Mar 6 at 4:17












For now, try getting it moved first.
– muru
Mar 6 at 4:18




For now, try getting it moved first.
– muru
Mar 6 at 4:18












I can see it moved with the olddir command. Now use postrotate to compress?
– cogitoergosum
Mar 6 at 4:31




I can see it moved with the olddir command. Now use postrotate to compress?
– cogitoergosum
Mar 6 at 4:31




1




1




The manpage of logrotate.conf says that the postrotate script is run before the rotated file is compressed. It's possible that compress did not work in your earlier attempt because the postrotate script failed.
– muru
Mar 6 at 4:33




The manpage of logrotate.conf says that the postrotate script is run before the rotated file is compressed. It's possible that compress did not work in your earlier attempt because the postrotate script failed.
– muru
Mar 6 at 4:33















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1012123%2fdaily-compress-log-files-not-working%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1012123%2fdaily-compress-log-files-not-working%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

pylint3 and pip3 broken

Missing snmpget and snmpwalk

How to enroll fingerprints to Ubuntu 17.10 with VFS491