Posted: Sun Jun 20, 2021 13:44 Post subject: [SOLVED] How to run syslog with custom switches?
Hello,
I am currently running syslog with default options along side remote server to my local ip.
Also, i want syslog server to log to a shared memory buffer.
Have read that syslog needs to be restarted with the -C[KB] switch, but i don't know the default switches, i am sort of GUI user. -
Code:
-n Run in foreground
-O FILE Log to given file (default=/var/log/messages)
-l n Set local log level
-S Smaller logging output
-s SIZE Max size (KB) before rotate (default=200KB, 0=off)
-b NUM Number of rotated logs to keep (default=1, max=99, 0=purge)
-R HOST[:PORT] Log to IP or hostname on PORT (default PORT=514/UDP)
-L Log locally and via network (default is network only if -R)
-C[size(KiB)] Log to shared mem buffer (read it using logread)
What are the default switches that i need to put it along side -C for syslog to work normally with remote server IP?
Would appreciate the help..
Regards!
Last edited by AlphaCJ44 on Sun Jun 27, 2021 11:41; edited 1 time in total
Joined: 08 May 2018 Posts: 14126 Location: Texas, USA
Posted: Sun Jun 20, 2021 17:48 Post subject:
The syslog, klog, firewall log all go to a shared memory buffer by default, if I am not mistaken. Otherwise, they would survive a reboot. The webUI has the functionality to log to a remote server. Not sure what exactly you are trying to accomplish here. _________________ "Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT Pogo - A minimal level of ability is expected and needed... DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)
----------------------
Linux User #377467 counter.li.org / linuxcounter.net
The syslog, klog, firewall log all go to a shared memory buffer by default
Thanks for your reply.
But these logs cannot be read by logread, which I need for my purposes. Only by having logread I can efficiently run a loop inside my script. All I know is that syslog needs to be run with -C[sizeinkb] switch for logs to be read by logread.
Joined: 08 May 2018 Posts: 14126 Location: Texas, USA
Posted: Sun Jun 20, 2021 19:05 Post subject:
Default flags are
Code:
syslogd -Z -L
Z is a custom switch so people can have their syslogs output local time zone instead of kernel time (UTC). Syslogd / klogd log locally to /tmp/var/log/messages, which is a memory buffer and doesn't survive a reboot. So, you're going to log to a memory buffer twice... and it would be great if you'd share the larger picture purpose for those following along in the forum _________________ "Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT Pogo - A minimal level of ability is expected and needed... DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)
----------------------
Linux User #377467 counter.li.org / linuxcounter.net
Thanks for your help guys.
I should've mentioned this earlier...
Actually I want to run this script which requires logread.
Code:
#!/bin/sh
name="work"
logread -f | while read line
do
if [ "${line#*$name*}" != "$line" ]
then
logger -t 'checkwork' 'workdone'
fi
done
The loop should run whenever a new line pops up in system log, it matches the string found in name variable, and should execute commands inside then block if match is found.