logrotate: error opening (No such file or directory)

Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I got an error message. This is sent to my mail box automatically.
/etc/cron.daily/logrotate:
error: error opening /var/log/apache2/access.log.1.gz: No such file or directory
error: error opening /var/log/apache2/myhost/access.log.1.gz: No such file or directory
I also check my /var/log/apache2/* and /var/log/apache2/myhost/* those directories. There aren't the file access.log.1.gz, but definitely a file access.log.1 existed on the directories. I just start to configure logrotate this tool for my log file management and my apache have run for a long period, at least 30 log files existed on my directories. Currently, I have no idea why it happened like this.
My /etc/logrotate is as below:
/var/log/apache2/*.log
daily
missingok
rotate 10
compress
delaycompress
# notifempty
create 640 root adm
sharedscripts
postrotate
/etc/init.d/apache2 reload > /dev/null;
endscript
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then
run-parts /etc/logrotate.d/httpd-prerotate;
fi;
endscript
/var/log/apache2/myhost/*.log
daily
missingok
rotate 10
compress
delaycompress
# notifempty
create 640 root adm
sharedscripts
postrotate
/etc/init.d/apache2 reload > /dev/null;
endscript
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then
run-parts /etc/logrotate.d/httpd-prerotate;
fi;
endscript
apache-httpd logrotate logs
add a comment |Â
up vote
1
down vote
favorite
I got an error message. This is sent to my mail box automatically.
/etc/cron.daily/logrotate:
error: error opening /var/log/apache2/access.log.1.gz: No such file or directory
error: error opening /var/log/apache2/myhost/access.log.1.gz: No such file or directory
I also check my /var/log/apache2/* and /var/log/apache2/myhost/* those directories. There aren't the file access.log.1.gz, but definitely a file access.log.1 existed on the directories. I just start to configure logrotate this tool for my log file management and my apache have run for a long period, at least 30 log files existed on my directories. Currently, I have no idea why it happened like this.
My /etc/logrotate is as below:
/var/log/apache2/*.log
daily
missingok
rotate 10
compress
delaycompress
# notifempty
create 640 root adm
sharedscripts
postrotate
/etc/init.d/apache2 reload > /dev/null;
endscript
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then
run-parts /etc/logrotate.d/httpd-prerotate;
fi;
endscript
/var/log/apache2/myhost/*.log
daily
missingok
rotate 10
compress
delaycompress
# notifempty
create 640 root adm
sharedscripts
postrotate
/etc/init.d/apache2 reload > /dev/null;
endscript
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then
run-parts /etc/logrotate.d/httpd-prerotate;
fi;
endscript
apache-httpd logrotate logs
What do you have in/etc/logrotate.d/httpd-prerotate? You should probably not do it twice, norapache2 reloadin fact but this is what you are doing because of the two types of logs where in fact they pertain to the same "system" (Apache). Also you seem to miss a '*' it sould be*.logtwice not just.log. You can also launchlogrotatewith the-doption to see what it is doing.
â Patrick Mevzek
Feb 12 '17 at 15:01
Hi, I mark one of them due to your saying that the /etc/logrotate.d/httpd-prerotate is not existed actually. What do you mean *.log and .log? Here I do not know clearly. I run "logrotate -d apache2" this command. Shows up as below: "removing old log /var/log/apache2/myhost/access.log.1.gz error: error opening /var/log/apache2/myhost/access.log.1.gz: No such file or directory." I check my directory and get list which there are access.log, access.log.1, access.log.2.gz, access.log.3.gz, access.log.4.gz and etc... But, there aren't anyone called as "access.log.1.gz". Is this to make it stop?
â jefferyear
Feb 12 '17 at 16:54
Hi, I got the recent message on my mail box. <code> /etc/cron.daily/logrotate: error: error opening /var/log/apache2/access.log.1.gz: No such file or directory error: error opening /var/log/apache2/myhost/access.log.1.gz: No such file or directory </code> It miss the first one compressed file only and then don't go through to do the next one. I want to know how to compress the first one either. This may help to let it know and continue to run the script.
â jefferyear
Feb 13 '17 at 0:11
If your current data is not important I would recommend starting from scratch. Stop Apache, delete all Apache log files, restart Apache, and let logrotate run normally. Otherwise to compressaccess.log.1just dogzip access.log.1
â Patrick Mevzek
Feb 14 '17 at 0:39
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I got an error message. This is sent to my mail box automatically.
/etc/cron.daily/logrotate:
error: error opening /var/log/apache2/access.log.1.gz: No such file or directory
error: error opening /var/log/apache2/myhost/access.log.1.gz: No such file or directory
I also check my /var/log/apache2/* and /var/log/apache2/myhost/* those directories. There aren't the file access.log.1.gz, but definitely a file access.log.1 existed on the directories. I just start to configure logrotate this tool for my log file management and my apache have run for a long period, at least 30 log files existed on my directories. Currently, I have no idea why it happened like this.
My /etc/logrotate is as below:
/var/log/apache2/*.log
daily
missingok
rotate 10
compress
delaycompress
# notifempty
create 640 root adm
sharedscripts
postrotate
/etc/init.d/apache2 reload > /dev/null;
endscript
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then
run-parts /etc/logrotate.d/httpd-prerotate;
fi;
endscript
/var/log/apache2/myhost/*.log
daily
missingok
rotate 10
compress
delaycompress
# notifempty
create 640 root adm
sharedscripts
postrotate
/etc/init.d/apache2 reload > /dev/null;
endscript
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then
run-parts /etc/logrotate.d/httpd-prerotate;
fi;
endscript
apache-httpd logrotate logs
I got an error message. This is sent to my mail box automatically.
/etc/cron.daily/logrotate:
error: error opening /var/log/apache2/access.log.1.gz: No such file or directory
error: error opening /var/log/apache2/myhost/access.log.1.gz: No such file or directory
I also check my /var/log/apache2/* and /var/log/apache2/myhost/* those directories. There aren't the file access.log.1.gz, but definitely a file access.log.1 existed on the directories. I just start to configure logrotate this tool for my log file management and my apache have run for a long period, at least 30 log files existed on my directories. Currently, I have no idea why it happened like this.
My /etc/logrotate is as below:
/var/log/apache2/*.log
daily
missingok
rotate 10
compress
delaycompress
# notifempty
create 640 root adm
sharedscripts
postrotate
/etc/init.d/apache2 reload > /dev/null;
endscript
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then
run-parts /etc/logrotate.d/httpd-prerotate;
fi;
endscript
/var/log/apache2/myhost/*.log
daily
missingok
rotate 10
compress
delaycompress
# notifempty
create 640 root adm
sharedscripts
postrotate
/etc/init.d/apache2 reload > /dev/null;
endscript
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then
run-parts /etc/logrotate.d/httpd-prerotate;
fi;
endscript
apache-httpd logrotate logs
apache-httpd logrotate logs
edited Feb 13 '17 at 4:04
Jeff Schaller
33.1k849111
33.1k849111
asked Feb 12 '17 at 14:12
jefferyear
3318
3318
What do you have in/etc/logrotate.d/httpd-prerotate? You should probably not do it twice, norapache2 reloadin fact but this is what you are doing because of the two types of logs where in fact they pertain to the same "system" (Apache). Also you seem to miss a '*' it sould be*.logtwice not just.log. You can also launchlogrotatewith the-doption to see what it is doing.
â Patrick Mevzek
Feb 12 '17 at 15:01
Hi, I mark one of them due to your saying that the /etc/logrotate.d/httpd-prerotate is not existed actually. What do you mean *.log and .log? Here I do not know clearly. I run "logrotate -d apache2" this command. Shows up as below: "removing old log /var/log/apache2/myhost/access.log.1.gz error: error opening /var/log/apache2/myhost/access.log.1.gz: No such file or directory." I check my directory and get list which there are access.log, access.log.1, access.log.2.gz, access.log.3.gz, access.log.4.gz and etc... But, there aren't anyone called as "access.log.1.gz". Is this to make it stop?
â jefferyear
Feb 12 '17 at 16:54
Hi, I got the recent message on my mail box. <code> /etc/cron.daily/logrotate: error: error opening /var/log/apache2/access.log.1.gz: No such file or directory error: error opening /var/log/apache2/myhost/access.log.1.gz: No such file or directory </code> It miss the first one compressed file only and then don't go through to do the next one. I want to know how to compress the first one either. This may help to let it know and continue to run the script.
â jefferyear
Feb 13 '17 at 0:11
If your current data is not important I would recommend starting from scratch. Stop Apache, delete all Apache log files, restart Apache, and let logrotate run normally. Otherwise to compressaccess.log.1just dogzip access.log.1
â Patrick Mevzek
Feb 14 '17 at 0:39
add a comment |Â
What do you have in/etc/logrotate.d/httpd-prerotate? You should probably not do it twice, norapache2 reloadin fact but this is what you are doing because of the two types of logs where in fact they pertain to the same "system" (Apache). Also you seem to miss a '*' it sould be*.logtwice not just.log. You can also launchlogrotatewith the-doption to see what it is doing.
â Patrick Mevzek
Feb 12 '17 at 15:01
Hi, I mark one of them due to your saying that the /etc/logrotate.d/httpd-prerotate is not existed actually. What do you mean *.log and .log? Here I do not know clearly. I run "logrotate -d apache2" this command. Shows up as below: "removing old log /var/log/apache2/myhost/access.log.1.gz error: error opening /var/log/apache2/myhost/access.log.1.gz: No such file or directory." I check my directory and get list which there are access.log, access.log.1, access.log.2.gz, access.log.3.gz, access.log.4.gz and etc... But, there aren't anyone called as "access.log.1.gz". Is this to make it stop?
â jefferyear
Feb 12 '17 at 16:54
Hi, I got the recent message on my mail box. <code> /etc/cron.daily/logrotate: error: error opening /var/log/apache2/access.log.1.gz: No such file or directory error: error opening /var/log/apache2/myhost/access.log.1.gz: No such file or directory </code> It miss the first one compressed file only and then don't go through to do the next one. I want to know how to compress the first one either. This may help to let it know and continue to run the script.
â jefferyear
Feb 13 '17 at 0:11
If your current data is not important I would recommend starting from scratch. Stop Apache, delete all Apache log files, restart Apache, and let logrotate run normally. Otherwise to compressaccess.log.1just dogzip access.log.1
â Patrick Mevzek
Feb 14 '17 at 0:39
What do you have in
/etc/logrotate.d/httpd-prerotate ? You should probably not do it twice, nor apache2 reload in fact but this is what you are doing because of the two types of logs where in fact they pertain to the same "system" (Apache). Also you seem to miss a '*' it sould be *.log twice not just .log. You can also launch logrotate with the -d option to see what it is doing.â Patrick Mevzek
Feb 12 '17 at 15:01
What do you have in
/etc/logrotate.d/httpd-prerotate ? You should probably not do it twice, nor apache2 reload in fact but this is what you are doing because of the two types of logs where in fact they pertain to the same "system" (Apache). Also you seem to miss a '*' it sould be *.log twice not just .log. You can also launch logrotate with the -d option to see what it is doing.â Patrick Mevzek
Feb 12 '17 at 15:01
Hi, I mark one of them due to your saying that the /etc/logrotate.d/httpd-prerotate is not existed actually. What do you mean *.log and .log? Here I do not know clearly. I run "logrotate -d apache2" this command. Shows up as below: "removing old log /var/log/apache2/myhost/access.log.1.gz error: error opening /var/log/apache2/myhost/access.log.1.gz: No such file or directory." I check my directory and get list which there are access.log, access.log.1, access.log.2.gz, access.log.3.gz, access.log.4.gz and etc... But, there aren't anyone called as "access.log.1.gz". Is this to make it stop?
â jefferyear
Feb 12 '17 at 16:54
Hi, I mark one of them due to your saying that the /etc/logrotate.d/httpd-prerotate is not existed actually. What do you mean *.log and .log? Here I do not know clearly. I run "logrotate -d apache2" this command. Shows up as below: "removing old log /var/log/apache2/myhost/access.log.1.gz error: error opening /var/log/apache2/myhost/access.log.1.gz: No such file or directory." I check my directory and get list which there are access.log, access.log.1, access.log.2.gz, access.log.3.gz, access.log.4.gz and etc... But, there aren't anyone called as "access.log.1.gz". Is this to make it stop?
â jefferyear
Feb 12 '17 at 16:54
Hi, I got the recent message on my mail box. <code> /etc/cron.daily/logrotate: error: error opening /var/log/apache2/access.log.1.gz: No such file or directory error: error opening /var/log/apache2/myhost/access.log.1.gz: No such file or directory </code> It miss the first one compressed file only and then don't go through to do the next one. I want to know how to compress the first one either. This may help to let it know and continue to run the script.
â jefferyear
Feb 13 '17 at 0:11
Hi, I got the recent message on my mail box. <code> /etc/cron.daily/logrotate: error: error opening /var/log/apache2/access.log.1.gz: No such file or directory error: error opening /var/log/apache2/myhost/access.log.1.gz: No such file or directory </code> It miss the first one compressed file only and then don't go through to do the next one. I want to know how to compress the first one either. This may help to let it know and continue to run the script.
â jefferyear
Feb 13 '17 at 0:11
If your current data is not important I would recommend starting from scratch. Stop Apache, delete all Apache log files, restart Apache, and let logrotate run normally. Otherwise to compress
access.log.1 just do gzip access.log.1â Patrick Mevzek
Feb 14 '17 at 0:39
If your current data is not important I would recommend starting from scratch. Stop Apache, delete all Apache log files, restart Apache, and let logrotate run normally. Otherwise to compress
access.log.1 just do gzip access.log.1â Patrick Mevzek
Feb 14 '17 at 0:39
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
I got fixed.
There are two places modified by my new configuration.
Now, the /var/log/apache2/myhost/ is like below without any alone "access.log.1" and "error.log.1".
What is my configuration on my /etc/logrotate.d as below. I get rid of asterisk and make their name specificlly. Otherwise, I comment "delaycompress" this directive.
/var/log/apache2/myhost/access.log /var/log/apache2/myhost/error.log
daily
missingok
rotate 2
compress
# delaycompress
# notifempty
create 640 root adm
sharedscripts
postrotate
/etc/init.d/apache2 reload > /dev/null;
endscript
Here I add a file /etc/logrotate.conf. I comment out "compress" this also. Then, I execute "sudo logrotate -f /etc/logrotate.d/apache2". This mean to force it to implement this execution. The result is good. Thanks all.
# see "man logrotate" for details
# rotate log files weekly
weekly
# keep 4 weeks worth of backlogs
rotate 4
# create new (empty) log files after rotating old ones
create
# uncomment this if you want your log files compressed
compress
# packages drop log rotation information into this directory
include /etc/logrotate.d
# no packages own wtmp, or btmp -- we'll rotate them here
/var/log/wtmp
missingok
monthly
create 0664 root utmp
rotate 1
/var/log/btmp
missingok
monthly
create 0660 root utmp
rotate 1
# system-specific logs may be configured here
</code>
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
I got fixed.
There are two places modified by my new configuration.
Now, the /var/log/apache2/myhost/ is like below without any alone "access.log.1" and "error.log.1".
What is my configuration on my /etc/logrotate.d as below. I get rid of asterisk and make their name specificlly. Otherwise, I comment "delaycompress" this directive.
/var/log/apache2/myhost/access.log /var/log/apache2/myhost/error.log
daily
missingok
rotate 2
compress
# delaycompress
# notifempty
create 640 root adm
sharedscripts
postrotate
/etc/init.d/apache2 reload > /dev/null;
endscript
Here I add a file /etc/logrotate.conf. I comment out "compress" this also. Then, I execute "sudo logrotate -f /etc/logrotate.d/apache2". This mean to force it to implement this execution. The result is good. Thanks all.
# see "man logrotate" for details
# rotate log files weekly
weekly
# keep 4 weeks worth of backlogs
rotate 4
# create new (empty) log files after rotating old ones
create
# uncomment this if you want your log files compressed
compress
# packages drop log rotation information into this directory
include /etc/logrotate.d
# no packages own wtmp, or btmp -- we'll rotate them here
/var/log/wtmp
missingok
monthly
create 0664 root utmp
rotate 1
/var/log/btmp
missingok
monthly
create 0660 root utmp
rotate 1
# system-specific logs may be configured here
</code>
add a comment |Â
up vote
0
down vote
I got fixed.
There are two places modified by my new configuration.
Now, the /var/log/apache2/myhost/ is like below without any alone "access.log.1" and "error.log.1".
What is my configuration on my /etc/logrotate.d as below. I get rid of asterisk and make their name specificlly. Otherwise, I comment "delaycompress" this directive.
/var/log/apache2/myhost/access.log /var/log/apache2/myhost/error.log
daily
missingok
rotate 2
compress
# delaycompress
# notifempty
create 640 root adm
sharedscripts
postrotate
/etc/init.d/apache2 reload > /dev/null;
endscript
Here I add a file /etc/logrotate.conf. I comment out "compress" this also. Then, I execute "sudo logrotate -f /etc/logrotate.d/apache2". This mean to force it to implement this execution. The result is good. Thanks all.
# see "man logrotate" for details
# rotate log files weekly
weekly
# keep 4 weeks worth of backlogs
rotate 4
# create new (empty) log files after rotating old ones
create
# uncomment this if you want your log files compressed
compress
# packages drop log rotation information into this directory
include /etc/logrotate.d
# no packages own wtmp, or btmp -- we'll rotate them here
/var/log/wtmp
missingok
monthly
create 0664 root utmp
rotate 1
/var/log/btmp
missingok
monthly
create 0660 root utmp
rotate 1
# system-specific logs may be configured here
</code>
add a comment |Â
up vote
0
down vote
up vote
0
down vote
I got fixed.
There are two places modified by my new configuration.
Now, the /var/log/apache2/myhost/ is like below without any alone "access.log.1" and "error.log.1".
What is my configuration on my /etc/logrotate.d as below. I get rid of asterisk and make their name specificlly. Otherwise, I comment "delaycompress" this directive.
/var/log/apache2/myhost/access.log /var/log/apache2/myhost/error.log
daily
missingok
rotate 2
compress
# delaycompress
# notifempty
create 640 root adm
sharedscripts
postrotate
/etc/init.d/apache2 reload > /dev/null;
endscript
Here I add a file /etc/logrotate.conf. I comment out "compress" this also. Then, I execute "sudo logrotate -f /etc/logrotate.d/apache2". This mean to force it to implement this execution. The result is good. Thanks all.
# see "man logrotate" for details
# rotate log files weekly
weekly
# keep 4 weeks worth of backlogs
rotate 4
# create new (empty) log files after rotating old ones
create
# uncomment this if you want your log files compressed
compress
# packages drop log rotation information into this directory
include /etc/logrotate.d
# no packages own wtmp, or btmp -- we'll rotate them here
/var/log/wtmp
missingok
monthly
create 0664 root utmp
rotate 1
/var/log/btmp
missingok
monthly
create 0660 root utmp
rotate 1
# system-specific logs may be configured here
</code>
I got fixed.
There are two places modified by my new configuration.
Now, the /var/log/apache2/myhost/ is like below without any alone "access.log.1" and "error.log.1".
What is my configuration on my /etc/logrotate.d as below. I get rid of asterisk and make their name specificlly. Otherwise, I comment "delaycompress" this directive.
/var/log/apache2/myhost/access.log /var/log/apache2/myhost/error.log
daily
missingok
rotate 2
compress
# delaycompress
# notifempty
create 640 root adm
sharedscripts
postrotate
/etc/init.d/apache2 reload > /dev/null;
endscript
Here I add a file /etc/logrotate.conf. I comment out "compress" this also. Then, I execute "sudo logrotate -f /etc/logrotate.d/apache2". This mean to force it to implement this execution. The result is good. Thanks all.
# see "man logrotate" for details
# rotate log files weekly
weekly
# keep 4 weeks worth of backlogs
rotate 4
# create new (empty) log files after rotating old ones
create
# uncomment this if you want your log files compressed
compress
# packages drop log rotation information into this directory
include /etc/logrotate.d
# no packages own wtmp, or btmp -- we'll rotate them here
/var/log/wtmp
missingok
monthly
create 0664 root utmp
rotate 1
/var/log/btmp
missingok
monthly
create 0660 root utmp
rotate 1
# system-specific logs may be configured here
</code>
answered Feb 15 '17 at 15:32
jefferyear
3318
3318
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f344405%2flogrotate-error-opening-no-such-file-or-directory%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
What do you have in
/etc/logrotate.d/httpd-prerotate? You should probably not do it twice, norapache2 reloadin fact but this is what you are doing because of the two types of logs where in fact they pertain to the same "system" (Apache). Also you seem to miss a '*' it sould be*.logtwice not just.log. You can also launchlogrotatewith the-doption to see what it is doing.â Patrick Mevzek
Feb 12 '17 at 15:01
Hi, I mark one of them due to your saying that the /etc/logrotate.d/httpd-prerotate is not existed actually. What do you mean *.log and .log? Here I do not know clearly. I run "logrotate -d apache2" this command. Shows up as below: "removing old log /var/log/apache2/myhost/access.log.1.gz error: error opening /var/log/apache2/myhost/access.log.1.gz: No such file or directory." I check my directory and get list which there are access.log, access.log.1, access.log.2.gz, access.log.3.gz, access.log.4.gz and etc... But, there aren't anyone called as "access.log.1.gz". Is this to make it stop?
â jefferyear
Feb 12 '17 at 16:54
Hi, I got the recent message on my mail box. <code> /etc/cron.daily/logrotate: error: error opening /var/log/apache2/access.log.1.gz: No such file or directory error: error opening /var/log/apache2/myhost/access.log.1.gz: No such file or directory </code> It miss the first one compressed file only and then don't go through to do the next one. I want to know how to compress the first one either. This may help to let it know and continue to run the script.
â jefferyear
Feb 13 '17 at 0:11
If your current data is not important I would recommend starting from scratch. Stop Apache, delete all Apache log files, restart Apache, and let logrotate run normally. Otherwise to compress
access.log.1just dogzip access.log.1â Patrick Mevzek
Feb 14 '17 at 0:39