##
##  syslog-ng.conf - Syslog Daemon Configuration
##  (See syslog-ng(8) and syslog-ng.conf(5) for more information)
##

#   global options
options {
    sync(0);
    time_reopen(10);
    log_fifo_size(1000);
    long_hostnames(off);
    use_dns(no);
    use_fqdn(no);
    create_dirs(no);
    keep_hostname(yes);
};

#   message sources
source s_local {
    internal();
    unix-dgram("@l_prefix@/var/syslog-ng/syslog-ng.sock");
};
source s_remote {
    udp(ip(127.0.0.1) port(514));
    tcp(ip(127.0.0.1) port(514) max-connections(20));
};

#   message destinations
destination d_tty_all {
    usertty("*");
};
destination d_tty_root {
    usertty("root");
};
destination d_console {
    file("/dev/console");
};
destination d_logfile {
    file("@l_prefix@/var/syslog-ng/syslog-ng.log"
         template("$ISODATE $HOUR:$MIN:$SEC $TZ $HOST [$LEVEL] $MSG\n")
         template_escape(no)
    );
};

#   message filters
filter f_tty_all {
    level(emerg);
};
filter f_tty_root {
    level(emerg,alert) or
    (level(error) and facility(auth, kern));
};
filter f_console {
    level(emerg, alert, crit) or
    (level(error, warning, notice) and facility(auth, kern));
};
filter f_logfile {
    level(emerg);
};

#   message logging
log {
    source(s_local);
    source(s_remote);
    filter(f_console);
    destination(d_console);
};
log {
    source(s_local);
    source(s_remote);
    destination(d_logfile);
};
log {
    source(s_local);
    source(s_remote);
    filter(f_tty_root);
    destination(d_tty_root);
};
log {
    source(s_local);
    source(s_remote);
    filter(f_tty_all);
    destination(d_tty_all);
};
