Use Openwrt as a Syslog Server

Folks:
I would like to redirect log entries of a ESP32 to a Syslog server. I have many Openwrt AP which have plenty of headroom for processing power and storage on USB.

Can you pls provide me some pointers on how create a Syslog server on one of Openwrt machines. I tried to install syslog-ng but wasn't able to log anything. It appeared pretty simple but did not work.

If syslog-ng on an OpenWrt is a usable implement, I can post what I did and, perhaps, get some feedback. Otherwise point me to some usable and current resources.

Thanks.

hi,

"did not work" is quite a broad description of your problem. have you checked this guide for example: https://openwrt.org/docs/guide-user/perf_and_log/log.syslog-ng3 ?
you would need to change this part according to your need:

log {
        source(src);
        source(kernel);
        source(net); <- to process logs from net source, i.e. acting as a syslog receiver
        filter(notice_or_higher);
        destination(messages);
        # destination(syslogd_tcp); <- to forward logs to a remote syslog receiver, in your case it is not needed
};
2 Likes

It would be wise to provide details on what didn't work.

1 Like

Hi lleachii & grrr2
I had to revert changes back on the box, I tried. However, I will try again, this time on a test bed(spare box) and then post. I have recently started to make my own packaged sysupgrade (https://firmware-selector.openwrt.org) since it gives me tool to add packages that I normally need such as wpad-openssl and adding script that allows a wifi network to configure (don't have laptops with rj45 anymore).

Question: if I added syslog-ng in the packages, will it replace default syslog by itself?

Amazingly easy. Success in installing the syslog-ng (v4) after opkg remove logd. It works!
I can see my tasmota logs after I uncommented source line below:

log {
        source(src);
        source(net);
        source(kernel);
        destination(messages);

        # uncomment this line to open port 514 to receive messages
        #source(s_network);
};

Thanks.

root@R6100-86:~# opkg install syslog-ng
Installing syslog-ng (4.4.0-1) to root...
Downloading https://downloads.openwrt.org/releases/23.05.0-rc4/packages/mips_24kc/packages/syslog-ng_4.4.0-1_mips_24kc.ipk
Installing libpcre2 (10.42-1) to root...
Downloading https://downloads.openwrt.org/releases/23.05.0-rc4/packages/mips_24kc/base/libpcre2_10.42-1_mips_24kc.ipk
Installing libffi (3.4.2-2) to root...
Downloading https://downloads.openwrt.org/releases/23.05.0-rc4/packages/mips_24kc/packages/libffi_3.4.2-2_mips_24kc.ipk
Installing glib2 (2.74.0-5) to root...
Downloading https://downloads.openwrt.org/releases/23.05.0-rc4/packages/mips_24kc/packages/glib2_2.74.0-5_mips_24kc.ipk
Installing libdbi (0.9.0-5) to root...
Downloading https://downloads.openwrt.org/releases/23.05.0-rc4/packages/mips_24kc/packages/libdbi_0.9.0-5_mips_24kc.ipk
Installing libnghttp2-14 (1.51.0-1) to root...
Downloading https://downloads.openwrt.org/releases/23.05.0-rc4/packages/mips_24kc/packages/libnghttp2-14_1.51.0-1_mips_24kc.ipk
Installing libcurl4 (8.3.0-1) to root...
Downloading https://downloads.openwrt.org/releases/23.05.0-rc4/packages/mips_24kc/packages/libcurl4_8.3.0-1_mips_24kc.ipk
Configuring libffi.
Configuring libpcre2.
Configuring glib2.
Configuring libdbi.
Configuring libnghttp2-14.
Configuring libcurl4.
Collected errors:
 * check_data_file_clashes: Package syslog-ng wants to install file /sbin/logread
        But that file is already provided by package  * logd
 * opkg_install_cmd: Cannot install package syslog-ng.
root@R6100-86:~# opkg remove logd
Removing package logd from root...
root@R6100-86:~# opkg install syslog-ng
Installing syslog-ng (4.4.0-1) to root...
Downloading https://downloads.openwrt.org/releases/23.05.0-rc4/packages/mips_24kc/packages/syslog-ng_4.4.0-1_mips_24kc.ipk
Configuring syslog-ng.
Command failed: Not found
root@R6100-86:~# opkg install logrotate
Installing logrotate (3.17.0-2) to root...
Downloading https://downloads.openwrt.org/releases/23.05.0-rc4/packages/mips_24kc/packages/logrotate_3.17.0-2_mips_24kc.ipk
Configuring logrotate.

1 Like