Cron stopped logging to /var/log/cron.log
up vote
0
down vote
favorite
A month ago I set cron to log to /var/log/cron.log
by modifying /etc/rsyslog.d/50-default.conf
. Logging worked great until I changed permissions on /var/log
(by easing permission restrictions), and forced logrotate to rotate the logs by executing logrotate --force /etc/rsyslog.d/50-default.conf
. Since then, cron seems to have stopped logging. There is no longer a /var/log/cron.log
. I executed sudo touch /var/log/cron.log
to create it, but it has remained 0 bytes since.
More details on what I did with the permissions:
I ran sudo chmod 775 /var/log
, and subsequently changed permissions back with sudo chmod 755 /var/log
. All other services appear to be logging correctly, and cron jobs are actually running (verified with ps aux | grep rsync
, since I only run rsync via cron).
I wasn't sure of the correct user and group access rights for cron.log
so I tried changing it to syslog:adm
like most of the other log files, but that didn't help, so I switched it back to root:root
,
Current permissions on cron.log: -rwxr-xr-x 1 root root 0 Apr 27 16:34 cron.log
Not sure where to go from here. I know I can have cron log to any file I'd like (either by adding >> /path/to/logfile
to end of cron job entries or by editing /etc/rsyslog.d/50-default.conf
), but for consistency, I would prefer it continue logging to cron.log. I suppose I could add >> /var/log/cron.log
to the end of each cron entry, but that seems a little hacky to me.
EDIT: As per my comment below, I changed the log location to /tmp/cron.log
and logging has resumed. At first, I had assumed this implied that either the folder or file permissions are wrong. However, I checked them against another machine running the same distro, and the folder permissions were correct. The file permissions were not restrictive enough, the correct permissions can be set with sudo chmod 640 cron.log
.
As a test, I deleted the empty cron.log, and it was never recreated. I modified the rsyslogd config to have it log to crond.log, but the file was never created.
cron logs rsyslog
bumped to the homepage by Community♦ 2 days ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
up vote
0
down vote
favorite
A month ago I set cron to log to /var/log/cron.log
by modifying /etc/rsyslog.d/50-default.conf
. Logging worked great until I changed permissions on /var/log
(by easing permission restrictions), and forced logrotate to rotate the logs by executing logrotate --force /etc/rsyslog.d/50-default.conf
. Since then, cron seems to have stopped logging. There is no longer a /var/log/cron.log
. I executed sudo touch /var/log/cron.log
to create it, but it has remained 0 bytes since.
More details on what I did with the permissions:
I ran sudo chmod 775 /var/log
, and subsequently changed permissions back with sudo chmod 755 /var/log
. All other services appear to be logging correctly, and cron jobs are actually running (verified with ps aux | grep rsync
, since I only run rsync via cron).
I wasn't sure of the correct user and group access rights for cron.log
so I tried changing it to syslog:adm
like most of the other log files, but that didn't help, so I switched it back to root:root
,
Current permissions on cron.log: -rwxr-xr-x 1 root root 0 Apr 27 16:34 cron.log
Not sure where to go from here. I know I can have cron log to any file I'd like (either by adding >> /path/to/logfile
to end of cron job entries or by editing /etc/rsyslog.d/50-default.conf
), but for consistency, I would prefer it continue logging to cron.log. I suppose I could add >> /var/log/cron.log
to the end of each cron entry, but that seems a little hacky to me.
EDIT: As per my comment below, I changed the log location to /tmp/cron.log
and logging has resumed. At first, I had assumed this implied that either the folder or file permissions are wrong. However, I checked them against another machine running the same distro, and the folder permissions were correct. The file permissions were not restrictive enough, the correct permissions can be set with sudo chmod 640 cron.log
.
As a test, I deleted the empty cron.log, and it was never recreated. I modified the rsyslogd config to have it log to crond.log, but the file was never created.
cron logs rsyslog
bumped to the homepage by Community♦ 2 days ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
I just had the same problem, I uncommented the line in /etc/rsyslog.d/50-default.conf to enable logging into cron.log but the file wasn't created :( I then manually created it with a touch and it was always empty. I finally succeeded to make working by typing : sudo chmod 640 /var/log/cron.log && sudo chown syslog:adm /var/log/cron.log
– Kervala
Oct 28 '17 at 14:05
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
A month ago I set cron to log to /var/log/cron.log
by modifying /etc/rsyslog.d/50-default.conf
. Logging worked great until I changed permissions on /var/log
(by easing permission restrictions), and forced logrotate to rotate the logs by executing logrotate --force /etc/rsyslog.d/50-default.conf
. Since then, cron seems to have stopped logging. There is no longer a /var/log/cron.log
. I executed sudo touch /var/log/cron.log
to create it, but it has remained 0 bytes since.
More details on what I did with the permissions:
I ran sudo chmod 775 /var/log
, and subsequently changed permissions back with sudo chmod 755 /var/log
. All other services appear to be logging correctly, and cron jobs are actually running (verified with ps aux | grep rsync
, since I only run rsync via cron).
I wasn't sure of the correct user and group access rights for cron.log
so I tried changing it to syslog:adm
like most of the other log files, but that didn't help, so I switched it back to root:root
,
Current permissions on cron.log: -rwxr-xr-x 1 root root 0 Apr 27 16:34 cron.log
Not sure where to go from here. I know I can have cron log to any file I'd like (either by adding >> /path/to/logfile
to end of cron job entries or by editing /etc/rsyslog.d/50-default.conf
), but for consistency, I would prefer it continue logging to cron.log. I suppose I could add >> /var/log/cron.log
to the end of each cron entry, but that seems a little hacky to me.
EDIT: As per my comment below, I changed the log location to /tmp/cron.log
and logging has resumed. At first, I had assumed this implied that either the folder or file permissions are wrong. However, I checked them against another machine running the same distro, and the folder permissions were correct. The file permissions were not restrictive enough, the correct permissions can be set with sudo chmod 640 cron.log
.
As a test, I deleted the empty cron.log, and it was never recreated. I modified the rsyslogd config to have it log to crond.log, but the file was never created.
cron logs rsyslog
A month ago I set cron to log to /var/log/cron.log
by modifying /etc/rsyslog.d/50-default.conf
. Logging worked great until I changed permissions on /var/log
(by easing permission restrictions), and forced logrotate to rotate the logs by executing logrotate --force /etc/rsyslog.d/50-default.conf
. Since then, cron seems to have stopped logging. There is no longer a /var/log/cron.log
. I executed sudo touch /var/log/cron.log
to create it, but it has remained 0 bytes since.
More details on what I did with the permissions:
I ran sudo chmod 775 /var/log
, and subsequently changed permissions back with sudo chmod 755 /var/log
. All other services appear to be logging correctly, and cron jobs are actually running (verified with ps aux | grep rsync
, since I only run rsync via cron).
I wasn't sure of the correct user and group access rights for cron.log
so I tried changing it to syslog:adm
like most of the other log files, but that didn't help, so I switched it back to root:root
,
Current permissions on cron.log: -rwxr-xr-x 1 root root 0 Apr 27 16:34 cron.log
Not sure where to go from here. I know I can have cron log to any file I'd like (either by adding >> /path/to/logfile
to end of cron job entries or by editing /etc/rsyslog.d/50-default.conf
), but for consistency, I would prefer it continue logging to cron.log. I suppose I could add >> /var/log/cron.log
to the end of each cron entry, but that seems a little hacky to me.
EDIT: As per my comment below, I changed the log location to /tmp/cron.log
and logging has resumed. At first, I had assumed this implied that either the folder or file permissions are wrong. However, I checked them against another machine running the same distro, and the folder permissions were correct. The file permissions were not restrictive enough, the correct permissions can be set with sudo chmod 640 cron.log
.
As a test, I deleted the empty cron.log, and it was never recreated. I modified the rsyslogd config to have it log to crond.log, but the file was never created.
cron logs rsyslog
cron logs rsyslog
edited Apr 29 '16 at 1:15
asked Apr 28 '16 at 15:24
Andy Forceno
1821418
1821418
bumped to the homepage by Community♦ 2 days ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 2 days ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
I just had the same problem, I uncommented the line in /etc/rsyslog.d/50-default.conf to enable logging into cron.log but the file wasn't created :( I then manually created it with a touch and it was always empty. I finally succeeded to make working by typing : sudo chmod 640 /var/log/cron.log && sudo chown syslog:adm /var/log/cron.log
– Kervala
Oct 28 '17 at 14:05
add a comment |
I just had the same problem, I uncommented the line in /etc/rsyslog.d/50-default.conf to enable logging into cron.log but the file wasn't created :( I then manually created it with a touch and it was always empty. I finally succeeded to make working by typing : sudo chmod 640 /var/log/cron.log && sudo chown syslog:adm /var/log/cron.log
– Kervala
Oct 28 '17 at 14:05
I just had the same problem, I uncommented the line in /etc/rsyslog.d/50-default.conf to enable logging into cron.log but the file wasn't created :( I then manually created it with a touch and it was always empty. I finally succeeded to make working by typing : sudo chmod 640 /var/log/cron.log && sudo chown syslog:adm /var/log/cron.log
– Kervala
Oct 28 '17 at 14:05
I just had the same problem, I uncommented the line in /etc/rsyslog.d/50-default.conf to enable logging into cron.log but the file wasn't created :( I then manually created it with a touch and it was always empty. I finally succeeded to make working by typing : sudo chmod 640 /var/log/cron.log && sudo chown syslog:adm /var/log/cron.log
– Kervala
Oct 28 '17 at 14:05
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Why you didn't try to edit /etc/rsyslog.conf
?!
As you know you can force rsyslog to log service that hasn't specific logger.
So I suggest read man rsyslog.conf
to know how make service making log and edit the service to send logs here ( edit somewhere like /etc/init.d/rsyslog
to configure log section ).
I would like it to continue logging to/var/log/cron.log
, though. However, you gave me an idea: for troubleshooting purposes, I'm going to change the destination in/etc/rsyslog.d/50-default.conf
to something like/tmp/cron.log
. If it begins logging again, that should indicates a permissions issue with either/var/log/
or the log file itself.
– Andy Forceno
Apr 28 '16 at 16:09
That's a good idea. I by myself for service I wrote use this function for logging. Hope it helps you ;)
– Ali Ghasempour
Apr 28 '16 at 16:14
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
Why you didn't try to edit /etc/rsyslog.conf
?!
As you know you can force rsyslog to log service that hasn't specific logger.
So I suggest read man rsyslog.conf
to know how make service making log and edit the service to send logs here ( edit somewhere like /etc/init.d/rsyslog
to configure log section ).
I would like it to continue logging to/var/log/cron.log
, though. However, you gave me an idea: for troubleshooting purposes, I'm going to change the destination in/etc/rsyslog.d/50-default.conf
to something like/tmp/cron.log
. If it begins logging again, that should indicates a permissions issue with either/var/log/
or the log file itself.
– Andy Forceno
Apr 28 '16 at 16:09
That's a good idea. I by myself for service I wrote use this function for logging. Hope it helps you ;)
– Ali Ghasempour
Apr 28 '16 at 16:14
add a comment |
up vote
0
down vote
Why you didn't try to edit /etc/rsyslog.conf
?!
As you know you can force rsyslog to log service that hasn't specific logger.
So I suggest read man rsyslog.conf
to know how make service making log and edit the service to send logs here ( edit somewhere like /etc/init.d/rsyslog
to configure log section ).
I would like it to continue logging to/var/log/cron.log
, though. However, you gave me an idea: for troubleshooting purposes, I'm going to change the destination in/etc/rsyslog.d/50-default.conf
to something like/tmp/cron.log
. If it begins logging again, that should indicates a permissions issue with either/var/log/
or the log file itself.
– Andy Forceno
Apr 28 '16 at 16:09
That's a good idea. I by myself for service I wrote use this function for logging. Hope it helps you ;)
– Ali Ghasempour
Apr 28 '16 at 16:14
add a comment |
up vote
0
down vote
up vote
0
down vote
Why you didn't try to edit /etc/rsyslog.conf
?!
As you know you can force rsyslog to log service that hasn't specific logger.
So I suggest read man rsyslog.conf
to know how make service making log and edit the service to send logs here ( edit somewhere like /etc/init.d/rsyslog
to configure log section ).
Why you didn't try to edit /etc/rsyslog.conf
?!
As you know you can force rsyslog to log service that hasn't specific logger.
So I suggest read man rsyslog.conf
to know how make service making log and edit the service to send logs here ( edit somewhere like /etc/init.d/rsyslog
to configure log section ).
answered Apr 28 '16 at 15:38
Ali Ghasempour
1543
1543
I would like it to continue logging to/var/log/cron.log
, though. However, you gave me an idea: for troubleshooting purposes, I'm going to change the destination in/etc/rsyslog.d/50-default.conf
to something like/tmp/cron.log
. If it begins logging again, that should indicates a permissions issue with either/var/log/
or the log file itself.
– Andy Forceno
Apr 28 '16 at 16:09
That's a good idea. I by myself for service I wrote use this function for logging. Hope it helps you ;)
– Ali Ghasempour
Apr 28 '16 at 16:14
add a comment |
I would like it to continue logging to/var/log/cron.log
, though. However, you gave me an idea: for troubleshooting purposes, I'm going to change the destination in/etc/rsyslog.d/50-default.conf
to something like/tmp/cron.log
. If it begins logging again, that should indicates a permissions issue with either/var/log/
or the log file itself.
– Andy Forceno
Apr 28 '16 at 16:09
That's a good idea. I by myself for service I wrote use this function for logging. Hope it helps you ;)
– Ali Ghasempour
Apr 28 '16 at 16:14
I would like it to continue logging to
/var/log/cron.log
, though. However, you gave me an idea: for troubleshooting purposes, I'm going to change the destination in /etc/rsyslog.d/50-default.conf
to something like /tmp/cron.log
. If it begins logging again, that should indicates a permissions issue with either /var/log/
or the log file itself.– Andy Forceno
Apr 28 '16 at 16:09
I would like it to continue logging to
/var/log/cron.log
, though. However, you gave me an idea: for troubleshooting purposes, I'm going to change the destination in /etc/rsyslog.d/50-default.conf
to something like /tmp/cron.log
. If it begins logging again, that should indicates a permissions issue with either /var/log/
or the log file itself.– Andy Forceno
Apr 28 '16 at 16:09
That's a good idea. I by myself for service I wrote use this function for logging. Hope it helps you ;)
– Ali Ghasempour
Apr 28 '16 at 16:14
That's a good idea. I by myself for service I wrote use this function for logging. Hope it helps you ;)
– Ali Ghasempour
Apr 28 '16 at 16:14
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f279769%2fcron-stopped-logging-to-var-log-cron-log%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I just had the same problem, I uncommented the line in /etc/rsyslog.d/50-default.conf to enable logging into cron.log but the file wasn't created :( I then manually created it with a touch and it was always empty. I finally succeeded to make working by typing : sudo chmod 640 /var/log/cron.log && sudo chown syslog:adm /var/log/cron.log
– Kervala
Oct 28 '17 at 14:05