[SOLVED] How to run syslog with custom switches?

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Author Message
AlphaCJ44
DD-WRT Novice


Joined: 01 Jan 2021
Posts: 21

PostPosted: Sun Jun 20, 2021 13:44    Post subject: [SOLVED] How to run syslog with custom switches? Reply with quote
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
Sponsor
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14125
Location: Texas, USA

PostPosted: Sun Jun 20, 2021 17:48    Post subject: Reply with quote
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
AlphaCJ44
DD-WRT Novice


Joined: 01 Jan 2021
Posts: 21

PostPosted: Sun Jun 20, 2021 18:49    Post subject: Reply with quote
kernel-panic69 wrote:
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.
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12837
Location: Netherlands

PostPosted: Sun Jun 20, 2021 19:03    Post subject: Reply with quote
I view my logs with:
Code:
cat /var/log/messages
or for specific purposes e.g.
Code:
grep -i wireguard /var/log/messages


You get the idea Smile

https://wiki.dd-wrt.com/wiki/index.php/Logging_with_DD-WRT

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14125
Location: Texas, USA

PostPosted: Sun Jun 20, 2021 19:05    Post subject: Reply with quote
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 Cool
_________________
"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
AlphaCJ44
DD-WRT Novice


Joined: 01 Jan 2021
Posts: 21

PostPosted: Mon Jun 21, 2021 18:25    Post subject: Reply with quote
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.
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum