User Tools

Site Tools


docs:guide-user:perf_and_log:log.syslog-ng3

syslog-ng

Installation

Replacing Default Logging with syslog-ng -- 2018

As of March, 2018, https://openwrt.org/packages/pkgdata/syslog-ng is version 3.8.1

On master of April, 2018, the following steps will replace the default OpenWRT logging with syslog-ng

  • Install syslog-ng and its dependencies
  • Disable the default logging with /etc/init.d/log disable or by removing the symlink in /etc/rc.d
  • Confirm that syslog-ng is enabled; /etc/rc.d/S20syslog-ng → ../init.d/syslog-ng
  • reboot

FIXME Much of the following appears to be from Backfire, c. 2011

# opkg install syslog-ng3

Do not install the syslog-ng package as it is very old and out-of-date.

In Backfire 10.3.1-rc4, there are missing depencies. Install with

# opkg install libdbi

Configuration

Configuration is controlled by /etc/syslog-ng.conf The default configuration logs to /var/log/messages.

Below is a sample configuration for logging to a remote server via UDP (from http://www.systemajik.com/blog/openwrt-syslog-ng-installation/):

options {
    chain_hostnames(off);
    sync(0);
    stats(0);
};

source src { unix-stream("/dlog"); internal(); };
source kernel { file("/proc/kmsg" log_prefix("kernel: ")); };

destination messages { file("/var/log/messages" log_fifo_size(256)); };
destination d_udp { udp("192.168.10.2" port(514)); };

log {
    source(src);
    source(kernel);
    destination(d_udp);
#    destination(messages);
};

Reconfiguration

To apply changes, it is not sufficient to simply restart the syslog-ng daemon. Instead, stop and start the daemon as follows (taken from http://baheyeldin.com/technology/linux/logging-with-syslog-ng-on-openwrt.html):

# killall syslog-ng
# /etc/init.d/syslog-ng start

IPv6 Logserver

To log to a logserver listening on an IPv6 address, use a udp6() destination in the configuration file:

...
destination d_udp6 { udp6("1234:5678:1011:1314::01" port(514)); };
...
log {
    source(src);
    source(kernel);
    destination(d_udp6);
};
...

Startup

# /etc/init.d/syslog-ng enable
# /etc/init.d/syslog-ng start
docs/guide-user/perf_and_log/log.syslog-ng3.txt · Last modified: 2018/04/02 16:06 by jeff