You are not logged in.

#1 2012-01-19 09:14:03

train_wreck
Member
Registered: 2011-10-22
Posts: 97

a small cron (cronie?) logging question

salut.

on both of my servers I have configured all of the syslog-ng output to be sent to /dev/tty12 via the (already present) "console_all" destination. On one server I have a script that uses the crond available in the base package (which appears to be a version called "cronie") to run every 15 minutes. As a result, my tty12 is filled with entries like the following (for a script named "download"):

/usr/sbin/crond[8964]: (root) CMD (/etc/scripts/download)

Every 15 minutes. This particular script already logs out to a separate location from within the script itself, and is done straight to a file without any console output; as such, I feel this persistent outputting of a single line into syslog is unnecessary. As far as I understand a single log line like this means that the cronjob executed successfully.

Is there any way to disable just the cron output from being logged to the screen? The reason I ask is simply because it would make the tty12 easier to read; the servers are in my basement and are almost always running with no keyboard, just a CRT connected to them displaying tty12, and I'd like to be able to view more information at a time.  I figured maybe commenting out references to cron in /etc/syslog-ng/syslog-ng.conf would do it, but this doesn't seem to have an effect. Ideally I would like to keep cron logging to its usual file (/var/log/crond.log) but just not have it go to the /dev/tty12.

I've included my syslog-ng.conf file below:

@version: 3.3
#
# /etc/syslog-ng/syslog-ng.conf
#

options {
  stats_freq (0);
  flush_lines (0);
  time_reopen (10);
  log_fifo_size (10000);
  chain_hostnames (off);
  use_dns (no);
  use_fqdn (no);
  create_dirs (no);
  keep_hostname (yes);
  perm(0640);
  group("log");
};

source src {
  unix-dgram("/dev/log");
  internal();
  file("/proc/kmsg");
};

destination d_authlog { file("/var/log/auth.log"); };
destination d_syslog { file("/var/log/syslog.log"); };
#destination d_cron { file("/var/log/crond.log"); };
destination d_daemon { file("/var/log/daemon.log"); };
destination d_kernel { file("/var/log/kernel.log"); };
destination d_lpr { file("/var/log/lpr.log"); };
destination d_user { file("/var/log/user.log"); };
destination d_uucp { file("/var/log/uucp.log"); };
destination d_mail { file("/var/log/mail.log"); };
destination d_news { file("/var/log/news.log"); };
destination d_ppp { file("/var/log/ppp.log"); };
destination d_debug { file("/var/log/debug.log"); };
destination d_messages { file("/var/log/messages.log"); };
destination d_errors { file("/var/log/errors.log"); };
destination d_everything { file("/var/log/everything.log"); };
destination d_iptables { file("/var/log/iptables.log"); };
destination d_acpid { file("/var/log/acpid.log"); };
destination d_console { usertty("root"); };

# Log everything to tty12
destination console_all { file("/dev/tty12"); };

filter f_auth { facility(auth); };
filter f_authpriv { facility(auth, authpriv); };
filter f_syslog { program(syslog-ng); };
#filter f_cron { facility(cron); };
filter f_daemon { facility(daemon); };
filter f_kernel { facility(kern) and not filter(f_iptables); };
filter f_lpr { facility(lpr); };
filter f_mail { facility(mail); };
filter f_news { facility(news); };
filter f_user { facility(user); };
filter f_uucp { facility(uucp); };
filter f_ppp { facility(local2); };
filter f_debug { not facility(auth, authpriv, news, mail); };
filter f_messages { level(info..warn) and not facility(auth, authpriv, mail, news, cron) and not program(syslog-ng) and not filter(f_iptables); };
filter f_everything { level(debug..emerg) and not facility(auth, authpriv); };
filter f_emergency { level(emerg); };
filter f_info { level(info); };
filter f_notice { level(notice); };
filter f_warn { level(warn); };
filter f_crit { level(crit); };
filter f_err { level(err); };
filter f_iptables { match("IN=" value("MESSAGE")) and match("OUT=" value("MESSAGE")); };
filter f_acpid { program("acpid"); };

log { source(src); filter(f_acpid); destination(d_acpid); };
log { source(src); filter(f_authpriv); destination(d_authlog); };
log { source(src); filter(f_syslog); destination(d_syslog); };
#log { source(src); filter(f_cron); destination(d_cron); };
log { source(src); filter(f_daemon); destination(d_daemon); };
log { source(src); filter(f_kernel); destination(d_kernel); };
log { source(src); filter(f_lpr); destination(d_lpr); };
log { source(src); filter(f_mail); destination(d_mail); };
log { source(src); filter(f_news); destination(d_news); };
log { source(src); filter(f_ppp); destination(d_ppp); };
log { source(src); filter(f_user); destination(d_user); };
log { source(src); filter(f_uucp); destination(d_uucp); };
#log { source(src); filter(f_debug); destination(d_debug); };
log { source(src); filter(f_messages); destination(d_messages); };
log { source(src); filter(f_err); destination(d_errors); };
log { source(src); filter(f_emergency); destination(d_console); };
log { source(src); filter(f_everything); destination(d_everything); };
log { source(src); filter(f_iptables); destination(d_iptables); };

# Log everything to tty12
log { source(src); destination(console_all); };

my inclination is that creating a filter rule that filters nothing but cron stuff and have that sent to the screen might be the solution? thanks in advance.

Offline

#2 2012-01-20 19:24:55

BentB
Member
From: Birkerød, Denmark
Registered: 2007-01-17
Posts: 22
Website

Re: a small cron (cronie?) logging question

cronie is apparently a fork of vixie-cron and to the best of my knowledge (I'm using dcron so I do not have a man page available) with vixie-cron you can suppress output to the system log by putting a '-' (minus sign) as the first character of the crontab line for your command.

Check the man page for your version of cron to see if you have that option.

Bent

Offline

Board footer

Powered by FluxBB