Commit f7f1afd3 authored by Maciej Lipinski's avatar Maciej Lipinski

[issue #20] add option to Kconfig to define where to store syslog output

parent 8c9ef674
......@@ -355,6 +355,14 @@ config DNS_DOMAIN
If CONFIG_DNS_SERVER is being used, this option may be
useful as well.
config LOCAL_SYSLOG_FILE
string "Store WRS syslog messages locally "
default "/tmp/syslog"
help
Select file to which syslog messages will be stored.
The file is rotated when reaching 1MB. If remote
server is specified, the messages go to both, server and local file.
config REMOTE_SYSLOG_SERVER
string "Send WRS syslog messages to this remote host"
help
......
......@@ -15,7 +15,8 @@ start_counter() {
start() {
# Check the configuration file: if there's no target, don't run the thing.
if ! grep -q '^##.*remote-host' /etc/rsyslog.conf; then
if ! grep -q '^##.*remote-host' /etc/rsyslog.conf -a
! grep -q '^##$outchannel' /etc/rsyslog.conf; then
echo -n "Starting rsyslog: "
start-stop-daemon -q -p /var/run/rsyslogd.pid -S \
--exec /usr/sbin/rsyslogd
......
......@@ -87,6 +87,14 @@ if [ ! -z "$CONFIG_REMOTE_SYSLOG_SERVER" ]; then
sed -i '/remote-host/ s/^##//' $T
sed -i "s/remote-host/$CONFIG_REMOTE_SYSLOG_SERVER/" $T
fi
if [ ! -z "$CONFIG_LOCAL_SYSLOG_FILE" ]; then
sed -i '/$outchannel/ s/^##//' $T
sed -i '/omfile/ s/^##//' $T
sed -i "s|/tmp/syslog|$CONFIG_LOCAL_SYSLOG_FILE|" $T
sed -i "s|/tmp/syslog|$CONFIG_LOCAL_SYSLOG_FILE|" $T
fi
mv $T /etc/rsyslog.conf
# Fix SNMP values: for all not-empty configs remove comment and replace value
......
......@@ -69,8 +69,8 @@ $PreserveFQDN on
# In total, syslog uses ~11MB (1MB for current output and 10MB for old
# logs) of /tmp/ space, (out of ~30MB available).
$outchannel log_rotation,/tmp/syslog 1048576,/wr/bin/log_rotate.sh /tmp/syslog
*.* :omfile:$log_rotation
##$outchannel log_rotation,/tmp/syslog 1048576,/wr/bin/log_rotate.sh /tmp/syslog
##*.* :omfile:$log_rotation
# ######### Receiving Messages from Remote Hosts ##########
# TCP Syslog Server:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment