/etc/syslog-ng/syslog-ng.conf (1)

From RaySoft
# ------------------------------------------------------------------------------
# syslog-ng.conf
# ==============
#
# Project   Gentoo 4 Shuttle DS57Ux
# Scope     Gentoo
# Copyright (C) 2022 by RaySoft, Zurich, Switzerland
# License   GNU General Public License (GPL) 2.0
#           https://www.gnu.org/licenses/gpl2.txt
#
# ------------------------------------------------------------------------------
# Options
# -------

@version: 3.7

@include "scl.conf"

options {
  # Enable or disable directory creation for destination files. Default: no
  create-dirs(yes);

  # Specifies how many lines are flushed to a destination at a time. The
  # syslog-ng OSE application waits for this number of lines to accumulate and
  # sends them off in a single batch. Increasing this number increases
  # throughput as more messages are sent in a single batch, but also increases
  # message latency. Default: 100
  flush-lines(10);

  # The default group of output files. By default, syslog-ng changes the
  # privileges of accessed files (for example /dev/null) to root.root 0600.
  group(root);

  # The number of messages that the output queue can store. Default: 10000
  log-fifo-size(1000);

  # The number of seconds between two MARK messages. MARK messages are generated
  # when there was no message traffic to inform the receiver that the connection
  # is still alive. If set to zero (0), no MARK messages are sent. Default: 1200
  mark-freq(600);

  # The default owner of output files. By default, syslog-ng changes the
  # privileges of accessed files (for example /dev/null) to root.root 0600.
  owner(root);

  # The default permission for output files. By default, syslog-ng changes the
  # privileges of accessed files (for example /dev/null) to root.root 0600.
  perm(0640);

  # The period between two STATS messages in seconds. STATS are log messages
  # sent by syslog-ng, containing statistics about dropped log messages. Set to
  # 0 to disable the STATS messages. Default: 600
  stats-freq(3600);

  # Specifies the timestamp format used when syslog-ng itself formats a
  # timestamp and nothing else specifies a format. Default: rfc3164
  ts-format(iso);
};

# ------------------------------------------------------------------------------
# Sources
# -------

source s_main {
  system();
  internal();
};

# ------------------------------------------------------------------------------
# Filters
# -------

filter f_bind {
  program("named");
};

filter f_cron {
  program("fcron");
};

filter f_dhcpd {
  program("dhcpd");
};

filter f_iptables {
  facility(kern)
  and message("iptables");
};

filter f_kern {
  facility(kern)
  and not filter(f_iptables);
};

filter f_mail {
  program("smtpd");
};


filter f_messages {
  not filter(f_bind)
  and not filter(f_cron)
  and not filter(f_dhcpd)
  and not filter(f_iptables)
  and not filter(f_kern)
  and not filter(f_mail);
};

# ------------------------------------------------------------------------------
# Destinations
# ------------

destination d_bind     { file("/var/log/named.log"); };
destination d_cron     { file("/var/log/cron.log"); };
destination d_dhcpd    { file("/var/log/dhcpd.log"); };
destination d_iptables { file("/var/log/iptables.log"); };
destination d_kern     { file("/var/log/kern.log"); };
destination d_mail     { file("/var/log/mail.log"); };
destination d_messages { file("/var/log/messages"); };

destination d_console  { file("/dev/tty12"); };

# ------------------------------------------------------------------------------
# Logs
# ----

log { source(s_main); filter(f_bind);     destination(d_bind); };
log { source(s_main); filter(f_cron);     destination(d_cron); };
log { source(s_main); filter(f_dhcpd);    destination(d_dhcpd); };
log { source(s_main); filter(f_iptables); destination(d_iptables); };
log { source(s_main); filter(f_kern);     destination(d_kern); };
log { source(s_main); filter(f_mail);     destination(d_mail); };
log { source(s_main); filter(f_messages); destination(d_messages); };

log { source(s_main); destination(d_console); };

# ------------------------------------------------------------------------------