Commit 2b635c3b authored by Maciej Lipinski's avatar Maciej Lipinski Committed by Grzegorz Daniluk

[syslog] specify default facility.priority in case it is not included in message

Some deamons/etc that log messages to syslog do not specify facility.level
in their messages. The logger is configured to parse the message looking
for facility.level (option: --prio-prefix). If the message does not include
If no facility.priority is specified, the logger will use the one specified
after -p, this is now provided. For example, PPSi does not specify
facility.priority in messages (hopefully, this will change), without
"-p daemon.info", it was reported as user.info. If user wishes to,
he/she can override. This is the default config
parent e5d2c796
...@@ -384,12 +384,13 @@ config WRS_LOG_HAL ...@@ -384,12 +384,13 @@ config WRS_LOG_HAL
help help
The string can be: The string can be:
- a pathname (e.g. /dev/kmsg), or - a pathname (e.g. /dev/kmsg), or
- a <facility>.<level> spefification like "daemon.debug", or - a <facility>.<level> specification like "daemon.debug", or
- "default_syslog", or - "default_syslog", or
- an empty string - an empty string
An empty string is used to represent no logging (like /dev/null). An empty string is used to represent no logging (like /dev/null).
When the string is "default_syslog", messages are sent to syslog with When the string is "default_syslog", messages are sent to syslog with
the <facility>.<level> inheritet from the messages. the <facility>.<level> inherited from the messages (if not specified
in the message, daemon.info is used by default).
When the string is "<facility>.<level>", all messages produced by When the string is "<facility>.<level>", all messages produced by
the WR HAL if syslog is configured will be passed to the syslog at the WR HAL if syslog is configured will be passed to the syslog at
the same <facility>.<level>, no matter of verbosity of a message. the same <facility>.<level>, no matter of verbosity of a message.
...@@ -419,12 +420,13 @@ config WRS_LOG_RTU ...@@ -419,12 +420,13 @@ config WRS_LOG_RTU
help help
The string can be: The string can be:
- a pathname (e.g. /dev/kmsg), or - a pathname (e.g. /dev/kmsg), or
- a <facility>.<level> spefification like "daemon.debug", or - a <facility>.<level> specification like "daemon.debug", or
- "default_syslog", or - "default_syslog", or
- an empty string - an empty string
An empty string is used to represent no logging (like /dev/null). An empty string is used to represent no logging (like /dev/null).
When the string is "default_syslog", messages are sent to syslog with When the string is "default_syslog", messages are sent to syslog with
the <facility>.<level> inheritet from the messages. the <facility>.<level> inherited from the messages(if not specified
in the message, daemon.info is used by default).
When the string is "<facility>.<level>", all messages produced by When the string is "<facility>.<level>", all messages produced by
the RTU if syslog is configured will be passed to the syslog at the RTU if syslog is configured will be passed to the syslog at
the same <facility>.<level>, no matter of verbosity of a message. the same <facility>.<level>, no matter of verbosity of a message.
...@@ -510,12 +512,13 @@ config WRS_LOG_OTHER ...@@ -510,12 +512,13 @@ config WRS_LOG_OTHER
This collective entry is to avoid number of entries in dot-config. This collective entry is to avoid number of entries in dot-config.
The string can be: The string can be:
- a pathname (e.g. /dev/kmsg), or - a pathname (e.g. /dev/kmsg), or
- a <facility>.<level> spefification like "daemon.debug", or - a <facility>.<level> specification like "daemon.debug", or
- "default_syslog", or - "default_syslog", or
- an empty string - an empty string
An empty string is used to represent no logging (like /dev/null). An empty string is used to represent no logging (like /dev/null).
When the string is "default_syslog", messages are sent to syslog with When the string is "default_syslog", messages are sent to syslog with
the <facility>.<level> inheritet from the messages. the <facility>.<level> inherited from the messages (if not specified
in the message, daemon.info is used by default).
When the string is "<facility>.<level>", all messages produced by When the string is "<facility>.<level>", all messages produced by
the programs if syslog is configured will be passed to the syslog at the programs if syslog is configured will be passed to the syslog at
the same <facility>.<level>, no matter of verbosity of a message. the same <facility>.<level>, no matter of verbosity of a message.
......
...@@ -26,7 +26,7 @@ if echo "$WRS_LOG" | grep / > /dev/null; then ...@@ -26,7 +26,7 @@ if echo "$WRS_LOG" | grep / > /dev/null; then
else else
# not a pathname: use verbatim # not a pathname: use verbatim
if [ "$WRS_LOG" = "default_syslog" ]; then if [ "$WRS_LOG" = "default_syslog" ]; then
eval LOGPIPE=\" 2\>\&1 \| logger -t $pBaseName --prio-prefix\" eval LOGPIPE=\" 2\>\&1 \| logger -t $pBaseName --prio-prefix -p daemon.info\"
else else
eval LOGPIPE=\" 2\>\&1 \| logger -t $pBaseName -p $WRS_LOG\" eval LOGPIPE=\" 2\>\&1 \| logger -t $pBaseName -p $WRS_LOG\"
fi fi
......
...@@ -23,7 +23,7 @@ start() { ...@@ -23,7 +23,7 @@ start() {
eval LOGPIPE=\" \> $WRS_LOG 2\>\&1 \"; eval LOGPIPE=\" \> $WRS_LOG 2\>\&1 \";
elif [ "$WRS_LOG" == "default_syslog" ]; then elif [ "$WRS_LOG" == "default_syslog" ]; then
# not a pathname: use verbatim # not a pathname: use verbatim
eval LOGPIPE=\" 2\>\&1 \| logger -t crond --prio-prefix\" eval LOGPIPE=\" 2\>\&1 \| logger -t crond --prio-prefix -p daemon.info\"
else else
# not a pathname: use verbatim # not a pathname: use verbatim
eval LOGPIPE=\" 2\>\&1 \| logger -t crond -p $WRS_LOG\" eval LOGPIPE=\" 2\>\&1 \| logger -t crond -p $WRS_LOG\"
......
...@@ -22,7 +22,7 @@ start() { ...@@ -22,7 +22,7 @@ start() {
eval LOGPIPE=\" \> $WRS_LOG 2\>\&1 \"; eval LOGPIPE=\" \> $WRS_LOG 2\>\&1 \";
elif [ "$WRS_LOG" == "default_syslog" ]; then elif [ "$WRS_LOG" == "default_syslog" ]; then
# not a pathname: use verbatim # not a pathname: use verbatim
eval LOGPIPE=\" 2\>\&1 \| logger -t hald --prio-prefix\" eval LOGPIPE=\" 2\>\&1 \| logger -t hald --prio-prefix -p daemon.info\"
else else
# not a pathname: use verbatim # not a pathname: use verbatim
eval LOGPIPE=\" 2\>\&1 \| logger -t hald -p $WRS_LOG\" eval LOGPIPE=\" 2\>\&1 \| logger -t hald -p $WRS_LOG\"
......
...@@ -72,9 +72,9 @@ fi ...@@ -72,9 +72,9 @@ fi
# if a pathname, use it # if a pathname, use it
if echo "$WRS_LOG" | grep / > /dev/null; then if echo "$WRS_LOG" | grep / > /dev/null; then
eval LOGPIPE=\" \> $WRS_LOG 2\>\&1 \"; eval LOGPIPE=\" \> $WRS_LOG 2\>\&1 \";
elif [ "$WRS_LOG" = "default_syslog" ]; then elif [ "$WRS_LOG" == "default_syslog" ]; then
# not a pathname: use verbatim # not a pathname: use verbatim
eval LOGPIPE=\" 2\>\&1 \| logger -t leap_seconds_file_update --prio-prefix\" eval LOGPIPE=\" 2\>\&1 \| logger -t leap_seconds_file_update --prio-prefix -p daemon.info\"
else else
# not a pathname: use verbatim # not a pathname: use verbatim
eval LOGPIPE=\" 2\>\&1 \| logger -t leap_seconds_file_update -p $WRS_LOG\" eval LOGPIPE=\" 2\>\&1 \| logger -t leap_seconds_file_update -p $WRS_LOG\"
......
...@@ -28,7 +28,7 @@ start() { ...@@ -28,7 +28,7 @@ start() {
eval LOGPIPE=\" \> $WRS_LOG 2\>\&1 \"; eval LOGPIPE=\" \> $WRS_LOG 2\>\&1 \";
elif [ "$WRS_LOG" == "default_syslog" ]; then elif [ "$WRS_LOG" == "default_syslog" ]; then
# not a pathname: use verbatim # not a pathname: use verbatim
eval LOGPIPE=\" 2\>\&1 \| logger -t ppsi --prio-prefix\" eval LOGPIPE=\" 2\>\&1 \| logger -t ppsi --prio-prefix -p daemon.info\"
else else
# not a pathname: use verbatim # not a pathname: use verbatim
eval LOGPIPE=\" 2\>\&1 \| logger -t ppsi -p $WRS_LOG\" eval LOGPIPE=\" 2\>\&1 \| logger -t ppsi -p $WRS_LOG\"
......
...@@ -23,7 +23,7 @@ start() { ...@@ -23,7 +23,7 @@ start() {
eval LOGPIPE=\" \> $WRS_LOG 2\>\&1 \"; eval LOGPIPE=\" \> $WRS_LOG 2\>\&1 \";
elif [ "$WRS_LOG" == "default_syslog" ]; then elif [ "$WRS_LOG" == "default_syslog" ]; then
# not a pathname: use verbatim # not a pathname: use verbatim
eval LOGPIPE=\" 2\>\&1 \| logger -t rtud --prio-prefix\" eval LOGPIPE=\" 2\>\&1 \| logger -t rtud --prio-prefix -p daemon.info\"
else else
# not a pathname: use verbatim # not a pathname: use verbatim
eval LOGPIPE=\" 2\>\&1 \| logger -t rtud -p $WRS_LOG\" eval LOGPIPE=\" 2\>\&1 \| logger -t rtud -p $WRS_LOG\"
......
...@@ -212,7 +212,7 @@ if echo "$WRS_LOG" | grep / > /dev/null; then ...@@ -212,7 +212,7 @@ if echo "$WRS_LOG" | grep / > /dev/null; then
eval LOGPIPE=\" \> $WRS_LOG 2\>\&1 \"; eval LOGPIPE=\" \> $WRS_LOG 2\>\&1 \";
elif [ "$WRS_LOG" = "default_syslog" ]; then elif [ "$WRS_LOG" = "default_syslog" ]; then
# not a pathname: use verbatim # not a pathname: use verbatim
eval LOGPIPE=\" 2\>\&1 \| logger -t $prefix --prio-prefix\" eval LOGPIPE=\" 2\>\&1 \| logger -t $prefix --prio-prefix -p daemon.info\"
else else
# not a pathname: use verbatim # not a pathname: use verbatim
eval LOGPIPE=\" 2\>\&1 \| logger -t $prefix -p $WRS_LOG\" eval LOGPIPE=\" 2\>\&1 \| logger -t $prefix -p $WRS_LOG\"
......
...@@ -30,7 +30,7 @@ start() { ...@@ -30,7 +30,7 @@ start() {
eval LOGPIPE=\" \> $WRS_LOG 2\>\&1 \"; eval LOGPIPE=\" \> $WRS_LOG 2\>\&1 \";
elif [ "$WRS_LOG" == "default_syslog" ]; then elif [ "$WRS_LOG" == "default_syslog" ]; then
# not a pathname: use verbatim # not a pathname: use verbatim
eval LOGPIPE=\" 2\>\&1 \| logger -t vlan --prio-prefix\" eval LOGPIPE=\" 2\>\&1 \| logger -t vlan --prio-prefix -p daemon.info\"
else else
eval LOGPIPE=\" 2\>\&1 \| logger -t vlan -p $WRS_LOG\" eval LOGPIPE=\" 2\>\&1 \| logger -t vlan -p $WRS_LOG\"
fi fi
......
...@@ -49,7 +49,7 @@ if echo "$WRS_LOG" | grep / > /dev/null; then ...@@ -49,7 +49,7 @@ if echo "$WRS_LOG" | grep / > /dev/null; then
eval LOGPIPE=\" \> $WRS_LOG 2\>\&1 \"; eval LOGPIPE=\" \> $WRS_LOG 2\>\&1 \";
elif [ "$WRS_LOG" == "default_syslog" ]; then elif [ "$WRS_LOG" == "default_syslog" ]; then
# not a pathname: use verbatim # not a pathname: use verbatim
eval LOGPIPE=\" 2\>\&1 \| logger -t auxclk --prio-prefix\" eval LOGPIPE=\" 2\>\&1 \| logger -t auxclk --prio-prefix -p daemon.info\"
else else
# not a pathname: use verbatim # not a pathname: use verbatim
eval LOGPIPE=\" 2\>\&1 \| logger -t auxclk -p $WRS_LOG\" eval LOGPIPE=\" 2\>\&1 \| logger -t auxclk -p $WRS_LOG\"
......
...@@ -35,7 +35,7 @@ start() { ...@@ -35,7 +35,7 @@ start() {
eval LOGPIPE=\" \> $WRS_LOG 2\>\&1 \"; eval LOGPIPE=\" \> $WRS_LOG 2\>\&1 \";
elif [ "$WRS_LOG" == "default_syslog" ]; then elif [ "$WRS_LOG" == "default_syslog" ]; then
# not a pathname: use verbatim # not a pathname: use verbatim
eval LOGPIPE=\" 2\>\&1 \| logger -t custom_boot_script --prio-prefix\" eval LOGPIPE=\" 2\>\&1 \| logger -t custom_boot_script --prio-prefix -p daemon.info\"
else else
# not a pathname: use verbatim # not a pathname: use verbatim
eval LOGPIPE=\" 2\>\&1 \| logger -t custom_boot_script -p $WRS_LOG\" eval LOGPIPE=\" 2\>\&1 \| logger -t custom_boot_script -p $WRS_LOG\"
...@@ -141,7 +141,7 @@ stop() { ...@@ -141,7 +141,7 @@ stop() {
eval LOGPIPE=\" \> $WRS_LOG 2\>\&1 \"; eval LOGPIPE=\" \> $WRS_LOG 2\>\&1 \";
elif "$WRS_LOG" = "default_syslog"; then elif "$WRS_LOG" = "default_syslog"; then
# not a pathname: use verbatim # not a pathname: use verbatim
eval LOGPIPE=\" 2\>\&1 \| logger -t custom_boot_script --prio-prefix\" eval LOGPIPE=\" 2\>\&1 \| logger -t custom_boot_script --prio-prefix -p daemon.info\"
else else
# not a pathname: use verbatim # not a pathname: use verbatim
eval LOGPIPE=\" 2\>\&1 \| logger -t custom_boot_script -p $WRS_LOG\" eval LOGPIPE=\" 2\>\&1 \| logger -t custom_boot_script -p $WRS_LOG\"
......
...@@ -29,7 +29,7 @@ start() { ...@@ -29,7 +29,7 @@ start() {
eval LOGPIPE=\" \> $WRS_LOG 2\>\&1 \"; eval LOGPIPE=\" \> $WRS_LOG 2\>\&1 \";
elif [ "$WRS_LOG" == "default_syslog" ]; then elif [ "$WRS_LOG" == "default_syslog" ]; then
# not a pathname: use verbatim # not a pathname: use verbatim
eval LOGPIPE=\" 2\>\&1 \| logger -t throttling --prio-prefix\" eval LOGPIPE=\" 2\>\&1 \| logger -t throttling --prio-prefix -p daemon.info\"
else else
# not a pathname: use verbatim # not a pathname: use verbatim
eval LOGPIPE=\" 2\>\&1 \| logger -t throttling -p $WRS_LOG\" eval LOGPIPE=\" 2\>\&1 \| logger -t throttling -p $WRS_LOG\"
......
...@@ -40,7 +40,7 @@ start() { ...@@ -40,7 +40,7 @@ start() {
eval LOGPIPE=\" \> $WRS_LOG 2\>\&1 \"; eval LOGPIPE=\" \> $WRS_LOG 2\>\&1 \";
elif [ "$WRS_LOG" == "default_syslog" ]; then elif [ "$WRS_LOG" == "default_syslog" ]; then
# not a pathname: use verbatim # not a pathname: use verbatim
eval LOGPIPE=\" 2\>\&1 \| logger -t watchdog --prio-prefix\" eval LOGPIPE=\" 2\>\&1 \| logger -t watchdog --prio-prefix -p daemon.info\"
else else
# not a pathname: use verbatim # not a pathname: use verbatim
eval LOGPIPE=\" 2\>\&1 \| logger -t watchdog -p $WRS_LOG\" eval LOGPIPE=\" 2\>\&1 \| logger -t watchdog -p $WRS_LOG\"
......
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