Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi Shruggy,
I have tried the commands you suggested, but looks like the command is not supported or enabled.
My syslog-ng version is 3.5.4.1.
Code:
root@TGT:~# syslog-ng-ctl config
Unknown command
Syntax: syslog-ng-ctl <command> [options]
Possible commands are:
stats Get syslog-ng statistics in CSV format
verbose Enable/query verbose messages
debug Enable/query debug messages
trace Enable/query trace messages
stop Stop syslog-ng process
reload Reload syslog-ng
reopen Re-open of log destination files
query Query syslog-ng statistics. Possible commands: list, get, get --sum
show-license-info Show information about the license
credentials Credentials manager
may be the version does not support the command , is there anyway i can still get the config info in this version.
And regarding my question about restarting the syslog-ng upon crash, yes you are right.
I have "/etc/init.d/syslog-ng" script in which "start|stop|reload|restart" are handled.
But the problem is :
I have to run them manually(as /etc/init.d/syslog-ng reload) to restart or reload syslog. I am looking for a way to restart as soon as it gets killed.
we can do that from inittab respawn, but is there any way from syslog itself.
In syslog global options there is an option time-reopen(), what exactly it is used for?
is there anyway i can still get the config info in this version.
Code:
#!/bin/sh
[ 0 = "$(id -u)" ] ||
{ echo You need to be root to perform this. >&2; exit 1;}
pipe="$(mktemp -u ${TMPDIR:-/tmp}/pipe.XXXXXX)"
trap "rm -f '$pipe'" EXIT HUP INT QUIT TERM
mkfifo "$pipe"
sed -n '$s/.*/8192/p;/^\s*#/d;/options\s*{/,/}/{
s/.*log_msg_size\s*(\(\w*\));.*/\1/p;T;q}' "$pipe" &
syslog-ng --preprocess-into="$pipe" 2>/dev/null
Quote:
Originally Posted by linxbee
I am looking for a way to restart as soon as it gets killed.
With SysVInit, respawning from inittab is the right thing to do.
What distro are you using? syslog-ng 3.5.4.1 is from around 2014. One common distribution that shipped with this version is Ubuntu 14.10 (Utopic Unicorn), long discontinued, BTW. That was the last Ubuntu release using Upstart. Around that time many major Linux distros started to adopt systemd. Otherwise, I can only think of specialized distros like Endian Firewall 3.3.2. DigitalOcean has an excellent tutorial describing how to do this for all common init systems.
Aside from the init systems, there are several tools capable of doing this: supervise from daemontools, monit, restartd.
Quote:
Originally Posted by linxbee
In syslog global options there is an option time-reopen(), what exactly it is used for?
I have tried the script you posted and got output as 8192, but I don't understand how its working and not sure that's correct value.
If 8192 is replaced by some other value , then the replaced value is coming as output.
About the restart, I actually have a problem where syslog-ng is not starting on boot sometimes.
The reason, I believe for that problem is , syslog-ng by default making use of "/var/lib/syslog-ng/syslog-ng.ctl" path as its control_path, in my configuration i could not find out when that path("/var/lib/syslog-ng") is getting created.
So my guess is syslog-ng is working in case if the path is available by the time syslog starts, not working if it does not, so i created the path manually before launching syslog-ng, i can see this is working always, but not really sure that's the cause.
That is the main reason i wanted a way to restart in case if syslog-ng fails to start on boot-up.
Below is the error i see, when it does not start, any idea about the error?
If 8192 is replaced by some other value , then the replaced value is coming as output.
8192 is the default value for log_msg_size taken from The syslog-ng OSE 3.5 Administrator Guide. The script outputs it if log_msg_size was not redefined in /etc/syslog-ng/syslog-ng.conf or any files included from it.
Quote:
Originally Posted by linxbee
any idea about the error?
You didn't answer my question about your distribution. Does it use SELinux? See RHBZ#675032.
nevertheless, all the information you provided is very use full to me.
Going forward, I have already shared you some info regarding my problem of syslog not generating logs some times on boot because of its standard path (/var/lib/syslog-ng)(not knowing when that is getting created before/after syslog-ng sometimes).
As a remedy, I am using my own path for ".ctl" and ".pid" creation and problem is resolved now.
But I have some other problem, since you are the only the one responding for syslog-ng issues, I am gonna request you and ask few more questions.
So, Shall I mark this solved and raise a new question or shall I ask here.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.