From: Michael K. <mic...@ip...> - 2023-10-03 23:24:37
|
A cool thanks Lonnie. We will change this in the interim. Regards Michael Knill From: Lonnie Abelbeck <li...@lo...> Date: Wednesday, 4 October 2023 at 7:14 am To: AstLinux Developers Mailing List <ast...@li...> Subject: Re: [Astlinux-devel] [Astlinux-users] Stopping logging of Crontab Update. It seems Michael (DE) was correct to whether a crond log-level existed for "error" logging and not "info" logging. Commit here [1] While the busybox crond only talks about a least verbose (default) level of "8", looking at the code a level of "9" can be used to ignore the "info" logs and only log "error" logs. Quite a few github projects use "crond -l 9" to get "error" only logs for syslog. More info here [2] Michael (AU), while using "crond -L /dev/null" is a valid way to ignore all logs, "crond -l 9" may be better in general to show crontab syntax errors. -- ## Cron Daemon #CRON_LOG_METHOD="file" # Log Methods: "syslog", "file" (/var/log/cron.log), or "none". Default is "syslog" #CRON_LOG_LEVEL="error" # Log Levels: "info" or "error". Default is "info" -- Lonnie [1] https://github.com/astlinux-project/astlinux/commit/3aaf769d50bc656ecfe3375ec7e93b3ba0c77375 [2] https://unix.stackexchange.com/a/414010 > On Oct 2, 2023, at 3:28 PM, Lonnie Abelbeck <li...@lo...> wrote: > > Added. > > https://github.com/astlinux-project/astlinux/commit/3bbd0980010ea3b2cb4f16b6a42010302c2fdbff > > Lonnie > > >> On Oct 1, 2023, at 7:07 PM, Michael Knill <mic...@ip...> wrote: >> >> Thanks guys for this. >> >> Yes I fully understand your first comment Lonnie. We have this problem already as we replace lighttpd.conf and sshd.conf so whenever we do an OS upgrade we check these for changes and merge accordingly. >> >> So we will do it this way for now until we build our own image or you add the rc.conf variable. Note that there are probably other init scripts we will change anyway so this is not a deal breaker currently but if its easy to do then yes Im all for it! >> >> Regards >> Michael Knill >> >> >> From: Michael Keuter <li...@mk...> >> Date: Sunday, 1 October 2023 at 10:57 pm >> To: AstLinux Developers Mailing List <ast...@li...> >> Subject: Re: [Astlinux-devel] [Astlinux-users] Stopping logging of Crontab >> >> Hi Lonnie, >> >> OK, "CRON_LOG_METHOD" sounds good to me. >> It depends what you do with the system, for most people this might be irrelevant. >> >> Michael (AU), what do you think? >> >> Michael >> >>> Am 30.09.2023 um 14:10 schrieb Lonnie Abelbeck <li...@lo...>: >>> >>> Hi Michael (DE), >>> >>> Logging only errors is not an option AFAIK. The default crond log level is 8, which is the least verbose. >>> >>> I briefly considered a rc.conf variable, something like: >>> -- >>> ## CRON Daemon >>> #CRON_LOG_METHOD="none" # Log Methods: "syslog", "file" (/var/log/cron.log), or "none". Default is "syslog" >>> -- >>> Additionally, logrotate would need to rotate /var/log/cron.log if it exists. >>> >>> Then I questioned whether it would be worth the trouble? >>> >>> Lonnie >>> >>>> On Sep 30, 2023, at 5:37 AM, Michael Keuter <li...@mk...> wrote: >>>> >>>> Hi, >>>> >>>> I find that logging also sometimes annoying (so I filter it out for the status tab. >>>> >>>> What about an additional "rc.conf" variable (default is NO): >>>> >>>> CRON_LOG_ERRORS_ONLY=yes >>>> >>>>> Am 30.09.2023 um 03:53 schrieb Lonnie Abelbeck <li...@lo...>: >>>>> >>>>> Hi Michael, >>>>> >>>>> Yes, "building our own image" is the correct way to tweak this. :-) >>>>> >>>>>> • Is it ok to do this? >>>>> >>>>> Not in general, but in this specific case it is probably fine. >>>>> >>>>> If you do the 'sed -i ...' as you stated, you are no longer using the read-only base image '/mnt/asturo/etc/init.d/crond' file, instead you are creating an edited writable '/mnt/asturw/etc/init.d/crond' overlay file. This will work as long as any future base image /etc/init.d/crond file does not have important changes your edited copy would not contain. >>>>> >>>>> The good news for this specific file, it was last changed on "Nov 2, 2015" and is probably not likely to change in the near future. As such, your 'sed -i ...' may be a useable fix until you are building our own image. >>>>> >>>>> Understand that when the day comes and you build an image with the fix, you would need to remove the '/mnt/asturw/etc/init.d/crond' file to see the read-only base image version. >>>>> >>>>>> • Will the changes disappear after an upgrade? >>>>> >>>>> The newly created/edited '/mnt/asturw/etc/init.d/crond' file will be used after any upgrade. >>>>> >>>>> Lonnie >>>>> >>>>>> On Sep 29, 2023, at 7:44 PM, Michael Knill <mic...@ip...> wrote: >>>>>> >>>>>> Hi Lonnie >>>>>> >>>>>> Moving this to the developer list. >>>>>> So as part of our upgrade we will run ‘sed -i 's/^ crond$/ crond -L \/dev\/null/g' /etc/init.d/crond’ which seems to work fine. >>>>>> So my questions are: >>>>>> • Is it ok to do this? >>>>>> • Will the changes disappear after an upgrade? >>>>>> >>>>>> We have decided that moving forward (timeframe unknown) we will be forking the repository and building our own image (finally you say!). >>>>>> We had toyed with the idea of completely rebuilding the system on standard platforms but now want to continue with Astlinux because of its reliability and small footprint. >>>>>> As such, the above will be unnecessary eventually. >>>>>> >>>>>> Regards >>>>>> Michael Knill >>>>>> >>>>>> >>>>>> From: Lonnie Abelbeck <li...@lo...> >>>>>> Date: Friday, 29 September 2023 at 4:43 am >>>>>> To: AstLinux Users Mailing List <ast...@li...> >>>>>> Subject: Re: [Astlinux-users] Stopping logging of Crontab >>>>>> >>>>>> Hi Michael, >>>>>> >>>>>> Looking at the /etc/init.d/crond init script, here [1] >>>>>> >>>>>> If the line "crond" was changed to "crond -L /var/log/crond.log" it would disable syslog and use that file ... but may need rotating if it gets large. >>>>>> >>>>>> If the line "crond" was changed to "crond -L /dev/null" it would disable syslog and disable logging (ie. to /dev/null). >>>>>> >>>>>> BTW, I manually tested both cases to be certain. >>>>>> >>>>>> Lonnie >>>>>> >>>>>> [1] https://github.com/astlinux-project/astlinux/blob/09e87eff8bca82bf4afab8dbe09560737dd80d5c/project/astlinux/target_skeleton/etc/init.d/crond#L38 >>>>>> >>>>>> >>>>>> >>>>>>> On Sep 27, 2023, at 8:01 PM, Michael Knill <mic...@ip...> wrote: >>>>>>> >>>>>>> Hi group >>>>>>> >>>>>>> Replying to this email again. I do understand below but just wondering if there is any way to turn off Cron logging totally or send to a separate log file? >>>>>>> >>>>>>> Regards >>>>>>> Michael Knill >>>>>>> >>>>>>> >>>>>>> From: Lonnie Abelbeck <li...@lo...> >>>>>>> Date: Friday, 31 March 2023 at 1:01 am >>>>>>> To: AstLinux Users Mailing List <ast...@li...> >>>>>>> Subject: Re: [Astlinux-users] Stopping logging of Crontab >>>>>>> >>>>>>> Hi Michael, >>>>>>> >>>>>>> The (busybox) crond daemon has a syslog level setting which defaults to 8, the least verbose log level. So no help there. >>>>>>> >>>>>>> Using the filter for the Status Tab, is a reasonable idea. >>>>>>> >>>>>>> >>>>>>> Personally, when executing shell commands on a regular interval of seconds/minutes, I prefer to use a bash shell script and the sleep builtin. (Using the sleep builtin keeps from spawning a new process whenever 'sleep' is called). >>>>>>> >>>>>>> The simplest example of this is the 'msmtpqueue' bash script [1] >>>>>>> >>>>>>> Basic code setup and loop: >>>>>>> -- >>>>>>> #!/bin/bash >>>>>>> >>>>>>> LOCKFILE="/var/lock/foobar.lock" >>>>>>> >>>>>>> # Robust 'bash' method of creating/testing for a lockfile >>>>>>> if ! ( set -o noclobber; echo "$$" > "$LOCKFILE" ) 2>/dev/null; then >>>>>>> echo "foobar: already running, lockfile \"$LOCKFILE\" exists, process id: $(cat "$LOCKFILE")." >>>>>>> return 9 >>>>>>> fi >>>>>>> >>>>>>> # Load 'sleep' builtin if it exists >>>>>>> if [ -f /usr/lib/bash/sleep ]; then >>>>>>> enable -f /usr/lib/bash/sleep sleep >>>>>>> fi >>>>>>> >>>>>>> #seconds to wait >>>>>>> wait=300 >>>>>>> >>>>>>> trap 'rm -f "$LOCKFILE"; exit $?' INT TERM EXIT >>>>>>> >>>>>>> while true; do >>>>>>> # do stuff >>>>>>> >>>>>>> sleep $wait >>>>>>> done >>>>>>> >>>>>>> rm -f "$LOCKFILE" >>>>>>> trap - INT TERM EXIT >>>>>>> -- >>>>>>> >>>>>>> Look at the actual code [1] for finer details. Another fairly simple example, asterisk-sip-monitor [2] which adds a PID file that can be removed to exit the script. >>>>>>> >>>>>>> Lonnie >>>>>>> >>>>>>> [1] https://github.com/astlinux-project/astlinux/blob/master/package/msmtp/msmtpqueue.sh >>>>>>> >>>>>>> [2] https://github.com/astlinux-project/astlinux/blob/master/package/asterisk/asterisk-sip-monitor >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>> On Mar 29, 2023, at 11:39 PM, Michael Knill <mic...@ip...> wrote: >>>>>>>> >>>>>>>> Short of putting in a filter for the Status Tab, is there any way to stop Crontab logging to Syslog. >>>>>>>> I now have a process that is run every 10 minutes and its annoying that it logs to Syslog each time. >>>>>>>> >>>>>>>> Regards >>>>>>>> >>>>>>>> Michael Knill >>>>>>>> Managing Director >> >> >> >> >> >> >> _______________________________________________ >> Astlinux-devel mailing list >> Ast...@li... >> https://lists.sourceforge.net/lists/listinfo/astlinux-devel >> _______________________________________________ >> Astlinux-devel mailing list >> Ast...@li... >> https://lists.sourceforge.net/lists/listinfo/astlinux-devel > > > > _______________________________________________ > Astlinux-devel mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/astlinux-devel _______________________________________________ Astlinux-devel mailing list Ast...@li... https://lists.sourceforge.net/lists/listinfo/astlinux-devel |