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.logand 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.










share|improve this question
















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

















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.logand 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.










share|improve this question
















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















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.logand 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.










share|improve this question















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.logand 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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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




















  • 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












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 ).






share|improve this answer





















  • 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











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















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

























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 ).






share|improve this answer





















  • 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















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 ).






share|improve this answer





















  • 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













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 ).






share|improve this answer












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 ).







share|improve this answer












share|improve this answer



share|improve this answer










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


















  • 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


















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Accessing regular linux commands in Huawei's Dopra Linux

Can't connect RFCOMM socket: Host is down

Kernel panic - not syncing: Fatal Exception in Interrupt