Fixed
Created: Nov 8, 2021
Updated: Mar 17, 2022
Resolved Date: Nov 25, 2021
Found In Version: 10.19.45.19
Fix Version: 10.19.45.21
Severity: Critical
Applicable for: Wind River Linux LTS 19
Component/s: Userspace
A customer reported an error when using the _*syslog-ng-ctl*_ utility. The stand-alone binary is looking for the _*ctl*_ socket at {_}*/var/run/syslog-ng/syslog-ng.ctl*{_}, but it is not right there. On the other hand, when the _*/etc/init.d/syslog*_ process starts it creates the _{*}syslog-ng.ct{*}{*}l{*}_ socket at {_}*/var/lib/syslog-ng/syslog-ng.ctl*{_}. Thus, there is a clear problem with the system's functionality.
Here is the error log that I extracted:
Error connecting control socket, socket='/var/run/syslog-ng/syslog-ng.ctl', error='No such file or directory'
I went further and found the root cause of the issue. Here is a patch that solved the problem:
[^0001-Fix-syslog-ng-ctl-default-control-file-location.patch]
^The patch basically fixes the path location at where the *_ctl_* socket is stored in the system (our side). If you take a look at the _*syslog-ng*_ source code, they have in this file _*syslog-ng/lib/syslog-ng.h*_ the following definitions:^
#define PATH_SYSLOG_NG_CONF SYSLOG_NG_PATH_SYSCONFDIR "/syslog-ng.conf"
#define PATH_INSTALL_DAT SYSLOG_NG_PATH_SYSCONFDIR "/install.dat"
#define PATH_PIDFILE SYSLOG_NG_PATH_PIDFILEDIR "/syslog-ng.pid"
#define PATH_CONTROL_SOCKET SYSLOG_NG_PATH_PIDFILEDIR "/syslog-ng.ctl"
#if SYSLOG_NG_ENABLE_ENV_WRAPPER
#define PATH_SYSLOGNG SYSLOG_NG_PATH_LIBEXECDIR "/syslog-ng"
#endif
#define PATH_PERSIST_CONFIG SYSLOG_NG_PATH_LOCALSTATEDIR "/syslog-ng.persist"
Where _*SYSLOG_NG_PATH_SYSCONFDIR*_, _*SYSLOG_NG_PATH_PIDFILEDIR*_, _*SYSLOG_NG_PATH_LIBEXECDIR*_, and _*SYSLOG_NG_PATH_LOCALSTATEDIR*_. Are calculated in build time from a CMake file. So, from my perspective, it is better and straightforward to fix it from our side than patch the application.
Please review the changes in the patch and merge them if you see pertinent. Let me know if you need a deeper explanation!
Create the project with the syslog-ng feature enabled:
./wrlinux-x/setup.sh --machine qemuarm --templates feature/syslog-ng --all-layers --dl-layer
Configure the environment:
. ./environment-setup-x86_64-wrlinuxsdk-linux && . ./oe-init-build-env
build the project:
bitbake wrlinux-image-small
Launch the qemuarm:
runqemu qemuarm nographic slirp
Test the _*syslog-ng-ctl*_ stand-alone binary:
syslog-ng-ctl config