1

EDIT1: syslog-ng launch command :
/usr/sbin/syslog-ng -u syslog -g syslog -R /tmp/syslog-ng.persist -F

commands used:

syslog-ng-ctl verbose --set=on and syslog-ng-ctl verbose

I am trying to run syslog-ng in verbose mode, but getting errors:

Error connecting control socket, socket='/var/lib/syslog-ng/syslog-ng.ctl', error='No such file or directory'

root@CHB:~# syslog-ng-ctl verbose
Error connecting control socket, socket='/var/lib/syslog-ng/syslog-ng.ctl', error='No such file or directory'

So created the ctl file and changed permission as required, but then again getting error:

Error connecting control socket, socket='/var/lib/syslog-ng/syslog-ng.ctl', error='Connection refused'

root@CHB:~# touch /var/lib/syslog-ng/syslog-ng.ctl
root@CHB:~# ls -l /var/lib/syslog-ng/syslog-ng.ctl
-rw-r--r--    1 root     root             0 Oct 21 19:11 /var/lib/syslog-ng/syslog-ng.ctl

root@CHB:~# chown syslog /var/lib/syslog-ng/syslog-ng.ctl
root@CHB:~# ls -l /var/lib/syslog-ng/syslog-ng.ctl
-rw-r--r--    1 syslog   root             0 Oct 21 19:11 /var/lib/syslog-ng/syslog-ng.ctl

root@CHB:~# chgrp syslog /var/lib/syslog-ng/syslog-ng.ctl
root@CHB:~# ls -l /var/lib/syslog-ng/syslog-ng.ctl
-rw-r--r--    1 syslog   syslog           0 Oct 21 19:11 /var/lib/syslog-ng/syslog-ng.ctl

root@CHB:~# chmod +x /var/lib/syslog-ng/syslog-ng.ctl
root@CHB:~# ls -l /var/lib/syslog-ng/syslog-ng.ctl
-rwxr-xr-x    1 syslog   syslog           0 Oct 21 19:11 /var/lib/syslog-ng/syslog-ng.ctl

root@CHB:~# syslog-ng-ctl verbose
Error connecting control socket, socket='/var/lib/syslog-ng/syslog-ng.ctl', error='Connection refused'

root@CHB:~# syslog-ng-ctl verbose --set=on
Error connecting control socket, socket='/var/lib/syslog-ng/syslog-ng.ctl', error='Connection refused'

my system info if it helps

root@CHB:~# cat /etc/issue
Poky (Yocto Project Reference Distro) 2.0 \n \l
root@CHB:~# uname -a
Linux CHB 3.2.48 #1 SMP Tue Mar 14 15:52:38 CET 2017 i686 GNU/Linux

if any additional info is needed, please let me know.
Appreciate any help in resolving the issue.

EDIT 2:
config file

#syslog settings
CS_SYSLOG_DAEMON="/usr/sbin/syslog-ng"
CS_SYSLOG_NAME="syslog-ng"
# user/group
CS_SYSLOG_USER="syslog"
CS_SYSLOG_GROUP="syslog"
# syslog port/interface to be used in syslog-ng.conf in case of remote logging
CS_SYSLOG_PORT="2020"
CS_SYSLOG_INTERFACE="eth1"
# syslog specific parameters: user, group, persist file in /tmp, in the foreground (start-stop-daemon will take care of the spawn)
CS_SYSLOG_ARGS="-u $CS_SYSLOG_USER -g $CS_SYSLOG_GROUP -R /tmp/syslog-ng.persist -F"
CS_SYSLOG_EXTRA_ARGS=

in the init.d script launch command, the above variables are sourced before

startdaemon $CS_SYSLOG_DAEMON $CS_SYSLOG_NAME $CS_SYSLOG_ARGS $CS_SYSLOG_EXTRA_ARGS
        ;;

Cheppy
  • 23
  • 1
  • 6
  • 1
    At first glance it seems you’re attempting to live update the settings of a service that is not actually running, which is doomed to fail. – Bob Jan 12 '21 at 08:56
  • @HermanB, actually from my configuration syslog is running as a deamon, with `start` `stop` and `restart` commands, even if i use that command also its failing – Cheppy Jan 12 '21 at 09:04
  • can you please suggest a way to run? – Cheppy Jan 12 '21 at 09:04

1 Answers1

1

Verbose output will be put into /var/log/messages.

Check the permissions of the directory where the sockets live. Normally the socket file is getting created during startup of a service, sometimes by the service itself. So check which user wants to start the service. and then fix the permissions of the directory where the socket file is getting created.

/var/lib/syslog-ng should be owned by the user syslog if syslog is the user who starts the service. As i'm not sure how your system looks in detail, i would suggest for debugging reasons only, to grant the group write access too.

rm /var/lib/syslog-ng/syslog-ng.ctl
chmod 770 /var/lib/syslog-ng
chown syslog:syslog /var/lib/syslog-ng

Just to be sure that there is no odd file in place which could break something, do the rm of the syslog-ng.ctl file. Change permissions to read, write, execute for the owner and the group. I guess others have nothing to do here on your system. Change owner and group to syslog for this directory.

Snooops
  • 78
  • 1
  • 10
  • this is my launch command: `/usr/sbin/syslog-ng -u syslog -g syslog -R /tmp/syslog-ng.persist -F` and user and group are set appropriately – Cheppy Jan 12 '21 at 09:02
  • Can you please share the permissions of the folder?```ls -la /var/lib/syslog-ng``` – Snooops Jan 12 '21 at 09:09
  • `root@CHB:~# ls -la /var/lib/syslog-ng total 8 drwxr-xr-x 2 root root 4096 Mar 14 2017 . drwxr-xr-x 9 root root 4096 Mar 14 2017 .. ` – Cheppy Jan 12 '21 at 09:13
  • can you share your syslog configuration file? – Snooops Jan 12 '21 at 09:14
  • the permission of `/var/lib/syslog-ng` is root:root, but inside `/var/lib/syslog-ng/` its syslog:syslog – Cheppy Jan 12 '21 at 09:16
  • _can you share your syslog configuration file?_ any particular lines you want to have a look at? – Cheppy Jan 12 '21 at 09:16
  • Dennis M, Updated as EDIT2 – Cheppy Jan 12 '21 at 09:29
  • yes you are right. Which user is used for the process? Check if a process is running ```ps aux | grep syslog``` or with your daemon manager, for systemd it could be ```systemctl status syslog-ng```. If the syslog is already running, stop it, after that you shouild be able to start the syslog-ng with verbose mode. – Snooops Jan 12 '21 at 09:36
  • `ls -la /var/lib/syslog-ng` permissions are `root:root` is that fine? – Cheppy Jan 12 '21 at 09:46
  • the permissions shoud set to ```syslog:syslog``` – Snooops Jan 12 '21 at 09:48
  • now both `syslog-ng` dir and file `syslog-ng.ctl` have `syslog:syslog`, but i still see error `Error connecting control socket, socket='/var/lib/syslog-ng/syslog-ng.ctl', error='Connection refused'` , i have also tried killing existing instance, what can be problem – Cheppy Jan 12 '21 at 09:57
  • Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/118364/discussion-between-dennis-m-and-cheppy). – Snooops Jan 12 '21 at 09:59
  • Actually the file `syslog-ng.ctl` was existing on boot, i am creating it to based on the first error `No such File or Directory` – Cheppy Jan 12 '21 at 10:00