Skip to content

Instantly share code, notes, and snippets.

@markizano
Created March 19, 2024 17:57
Show Gist options
  • Save markizano/14592304be3c64c7aa0105977532e15d to your computer and use it in GitHub Desktop.
Save markizano/14592304be3c64c7aa0105977532e15d to your computer and use it in GitHub Desktop.
Simple syslog-ng configuration for collecting everything in the system to logging to just a single destination file.
# Configuration file to replace `/etc/syslog-ng/syslog-ng.conf`
@version: 3.38
@include "scl.conf"
# Syslog-ng configuration file, compatible with default Debian syslogd
# installation.
# First, set some global options.
options {
chain_hostnames(off);
flush_lines(0);
use_dns(yes);
use_fqdn(no);
dns_cache(yes);
owner("root");
group("adm");
perm(0640);
stats_freq(0);
bad_hostname("^gconfd$");
ts_format("iso");
};
########################
# Sources
########################
# This is the default behavior of sysklogd package
# Logs may come from unix stream, but not from another machine.
#
source s_src {
system();
internal();
udp(ip(0.0.0.0) port(514));
# systemd uses `/dev/log`, so we have to avoid that here. -_-
unix-stream ("/dev/log");
# Uncomment if you are running a systemd-loggerd.
#systemd-syslog();
};
destination d_messages { file("/var/log/messages"); };
log { source(s_src); destination(d_messages); };
###
# Include all config files in /etc/syslog-ng/conf.d/
###
@include "/etc/syslog-ng/conf.d/*.conf"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment