Hi.

I’m one of the contributors to OpenWRT.

I was trying to map out a migration strategy from rsyslog to syslog-ng, but one 
thing I wasn’t able to figure out was how to get crond logging to go to syslog 
and not a file or be spilled out on the console.

We’re building 1.24.2.

I’ve enabled crond, but as I said it spills logging to /dev/console (even 
though -S, send logging to syslog, is supposed to be the default).

Looking at the running process, I see:

# lsof -p 2317
COMMAND  PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
crond   2317 root  cwd    DIR               0,14       27 2658 /etc/crontabs
crond   2317 root  rtd    DIR               0,14        0   11 /
crond   2317 root  txt    REG               31,0   365147 1604 /bin/busybox
crond   2317 root  mem    REG               31,0    68696  837 /lib/libgcc_s.so.
1
crond   2317 root  mem    REG               31,0   427153  810 /lib/libc.so
crond   2317 root  mem    REG               0,13        4 3520 /tmp/TZ
crond   2317 root    0r   CHR                1,3      0t0 2233 /dev/null
crond   2317 root    1w   CHR                1,3      0t0 2233 /dev/null
crond   2317 root    2w   CHR                1,3      0t0 2233 /dev/null
crond   2317 root    3u  unix 0xffff88040d3a8e00      0t0 1463 type=DGRAM
crond   2317 root    9r  FIFO                0,8      0t0 2657 pipe
# 

not sure what the DGRAM socket corresponds to…  On Linux /dev/log is normally 
implemented as a SOCK_STREAM socket, so I suspect it’s not that.

It was started as:

/usr/sbin/crond -f -c /etc/crontabs -l 5

via a startup script which leverages procd.  What am I missing?  Oh, hang on…

        if (!(opts & OPT_d) && G.log_filename == NULL) {
                /* logging to syslog */
                openlog(applet_name, LOG_CONS | LOG_PID, LOG_CRON);
                logmode = LOGMODE_SYSLOG;
        }


Why would LOG_CONS be selected unconditionally?  Shouldn’t that only be 
selected if (opts & OPT_f) ? i.e.

                openlog(applet_name, ((opts & OPT_f) ? LOG_CONS : 0) | LOG_PID, 
LOG_CRON);

Thanks,

-Philip

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to