From 672fcb4d3b342088d2f5c11e0fbb306eacae7b71 Mon Sep 17 00:00:00 2001 From: Martinski4GitHub <119833648+Martinski4GitHub@users.noreply.github.com> Date: Wed, 18 Feb 2026 02:10:38 -0800 Subject: [PATCH 01/10] New Functionality - Initial code to support automatic script updates via AMTM. - Adjusted code to allow searching for log files under a subdirectory of the "/opt/var/log" directory. Note that the 'messages' log file is a special case and cannot located be in a subdirectory. --- README.md | 4 +-- scribe.sh | 75 +++++++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 70 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 057a219..803d17a 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ **scribe** is a **syslog-ng** and **logrotate** installer for ASUS routers running **Asuswrt-Merlin** -## v3.2.10 -### Updated on 2026-Feb-15 +## v3.2.11 +### Updated on 2026-Feb-18 ## Getting Started diff --git a/scribe.sh b/scribe.sh index e128e59..41cba38 100644 --- a/scribe.sh +++ b/scribe.sh @@ -18,7 +18,7 @@ # curl --retry 3 "https://raw.githubusercontent.com/AMTM-OSR/scribe/master/scribe.h" -o "/jffs/scripts/scribe" && chmod 0755 /jffs/scripts/scribe && /jffs/scripts/scribe install # ################################################################## -# Last Modified: 2026-Feb-15 +# Last Modified: 2026-Feb-18 #----------------------------------------------------------------- ################ Shellcheck directives ################ @@ -34,11 +34,14 @@ ################################################################# readonly script_name="scribe" -readonly scribe_ver="v3.2.10" -readonly scriptVer_TAG="26021523" +readonly scribe_ver="v3.2.11" +readonly scriptVer_TAG="26021800" scribe_branch="develop" script_branch="$scribe_branch" +# To support automatic script updates from AMTM # +doScriptUpdateFromAMTM=true + # Ensure firmware binaries are used, not Entware # export PATH="/sbin:/bin:/usr/sbin:/usr/bin:$PATH" @@ -70,6 +73,14 @@ do action="$1" break ;; + amtmupdate) + action="$1" + if [ $# -gt 1 ] && [ "$2" = "check" ] + then banner=false + fi + shift + break + ;; *) action="$1" ; shift ;; @@ -237,6 +248,10 @@ readonly uiscribePath="$script_d/$uiscribeName" readonly uiscribeVerRegExp="v[0-9]{1,2}([.][0-9]{1,2})([.][0-9]{1,2})" readonly menuSepStr="${white} =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=${CLRct}\n\n" +isInteractive=false +[ -t 0 ] && ! tty | grep -qwi "NOT" && isInteractive=true +if ! "$isInteractive" ; then banner=false ; fi + # Check if Scribe is already installed by looking for link in /opt/bin # [ -e "/opt/bin/$script_name" ] && scribeInstalled=true || scribeInstalled=false @@ -1383,10 +1398,11 @@ _HasRouterMoreThan512MBtotalRAM_() } ##----------------------------------------## -## Modified by Martinski W. [2026-Feb-15] ## +## Modified by Martinski W. [2026-Feb-18] ## ##----------------------------------------## _Generate_ListOf_Filtered_LogFiles_() { + local logDirPath logFilePath setDirPerms=true local tmpSysLogList="${HOMEdir}/${script_name}_tempSysLogList_$$.txt" local tmpFilterList="${HOMEdir}/${script_name}_tempFltLogList_$$.txt" @@ -1402,8 +1418,15 @@ _Generate_ListOf_Filtered_LogFiles_() then continue #Avoid duplicates# fi echo "$logFilePath" >> "$tmpFilterList" + if "$setDirPerms" + then + logDirPath="$(dirname "$logFilePath")" + if echo "$logDirPath" | grep -qE "^${optVarLogDir}/.+" + then chmod 0755 "$logDirPath" 2>/dev/null + fi + fi done < "$syslogNg_StartSEM_FPath" printf '' > "$syslogD_InitRebootLogFPath" @@ -2077,7 +2107,7 @@ Menu_Filters() } ##----------------------------------------## -## Modified by Martinski W. [2026-Jan-30] ## +## Modified by Martinski W. [2026-Feb-18] ## ##----------------------------------------## Menu_Update() { @@ -2116,11 +2146,16 @@ Menu_Update() rm -f "$syslogNg_WaitnSEM_FPath" echo '1' > "$syslogNg_StartSEM_FPath" printf '' > "$syslogD_InitRebootLogFPath" - sh "$script_loc" filters gotzip nologo + if "$isInteractive" + then + sh "$script_loc" filters gotzip nologo + fi sh "$script_loc" status nologo run_scribe=true + return 0 else printf "\n ${white}*** %s ${red}NOT${white} updated! *** ${std}\n\n" "$script_name" + return 1 fi } @@ -2139,6 +2174,28 @@ Update_Version() fi } +##-------------------------------------## +## Added by Martinski W. [2026-Feb-18] ## +##-------------------------------------## +ScriptUpdateFromAMTM() +{ + if ! "$doScriptUpdateFromAMTM" + then + printf "Automatic script updates via AMTM are currently disabled.\n\n" + return 1 + fi + if ! SyslogNg_Running + then + printf "$sng is currently not running. Script updates are NOT allowed during this state.\n\n" + return 1 + fi + if [ $# -gt 0 ] && [ "$1" = "check" ] + then return 0 + fi + Menu_Update force + return "$?" +} + menu_forgrnd() { local doStart=false @@ -2964,6 +3021,10 @@ case "$action" in forceupdate) Update_Version force ;; + amtmupdate) + ScriptUpdateFromAMTM "$@" + exit "$?" + ;; develop) script_branch="develop" SetUpRepoBranchVars From 6fdfe9e3e8970b4c63181cd05ff53651357c0ded Mon Sep 17 00:00:00 2001 From: Martinski4GitHub <119833648+Martinski4GitHub@users.noreply.github.com> Date: Sun, 22 Feb 2026 01:24:40 -0800 Subject: [PATCH 02/10] Code Improvements Just some code improvements. --- README.md | 2 +- scribe.sh | 23 +++++++++++------------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 803d17a..b7fec94 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ **scribe** is a **syslog-ng** and **logrotate** installer for ASUS routers running **Asuswrt-Merlin** ## v3.2.11 -### Updated on 2026-Feb-18 +### Updated on 2026-Feb-22 ## Getting Started diff --git a/scribe.sh b/scribe.sh index 41cba38..08d4348 100644 --- a/scribe.sh +++ b/scribe.sh @@ -18,7 +18,7 @@ # curl --retry 3 "https://raw.githubusercontent.com/AMTM-OSR/scribe/master/scribe.h" -o "/jffs/scripts/scribe" && chmod 0755 /jffs/scripts/scribe && /jffs/scripts/scribe install # ################################################################## -# Last Modified: 2026-Feb-18 +# Last Modified: 2026-Feb-21 #----------------------------------------------------------------- ################ Shellcheck directives ################ @@ -35,7 +35,7 @@ readonly script_name="scribe" readonly scribe_ver="v3.2.11" -readonly scriptVer_TAG="26021800" +readonly scriptVer_TAG="26022123" scribe_branch="develop" script_branch="$scribe_branch" @@ -1371,18 +1371,17 @@ Show_SysLogNg_LoadedConfig() ##-------------------------------------## _AcquireFLock_() { - local opts="" - eval exec "$LR_FLock_FD>$LR_FLock_FName" - - if [ $# -eq 1 ] && [ "$1" = "nonblock" ] - then opts="-n" + local opts="-n" + if [ $# -gt 0 ] && [ "$1" = "waitblock" ] + then opts="" fi - flock -x $opts "$LR_FLock_FD" + eval exec "$LR_FLock_FD>$LR_FLock_FName" + flock -x $opts "$LR_FLock_FD" 2>/dev/null return "$?" } _ReleaseFLock_() -{ flock -u "$LR_FLock_FD" ; } +{ flock -u "$LR_FLock_FD" 2>/dev/null ; } ##-------------------------------------## ## Added by Martinski W. [2026-Jan-04] ## @@ -2295,7 +2294,7 @@ Gather_Debug() fi printf "\n%s\n### logrotate debug output:\n" "$debug_sep" >> "$script_debug" - if _AcquireFLock_ + if _AcquireFLock_ nonblock then _DoRotateLogFiles_ DEBUG _ReleaseFLock_ @@ -2875,7 +2874,7 @@ Scribe_Menu() ;; ld) delfr "$lr_temp" - if _AcquireFLock_ + if _AcquireFLock_ nonblock then _DoRotateLogFiles_ DEBUG TEMP _ReleaseFLock_ @@ -3089,7 +3088,7 @@ case "$action" in ;; LogRotateDebug) - if _AcquireFLock_ + if _AcquireFLock_ nonblock then delfr "$lr_temp" _DoRotateLogFiles_ DEBUG TEMP From 88de0344ac4636567d7fdd04a2cd4cf4f41a25ae Mon Sep 17 00:00:00 2001 From: Martinski4GitHub <119833648+Martinski4GitHub@users.noreply.github.com> Date: Wed, 25 Feb 2026 23:26:42 -0800 Subject: [PATCH 03/10] Improved Ethernet Filter Configuration Modified syslog-ng Ethernet filter configuration file to prevent it from capturing log entries intended for the Skynet/firewall log files --- syslog-ng.share/ethernet | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/syslog-ng.share/ethernet b/syslog-ng.share/ethernet index 8bf1993..18ceb6e 100644 --- a/syslog-ng.share/ethernet +++ b/syslog-ng.share/ethernet @@ -1,15 +1,17 @@ -# log ethernet change to /opt/var/log/ethernet.log only +# log ethernet change to /opt/var/log/ethernet.log only # +# Last Modified: 2026-Feb-25 # destination d_ethernet { file("/opt/var/log/ethernet.log"); }; filter f_kernel { - program("kernel"); + program("kernel") and + not match('BLOCKED -' value("MESSAGE")); }; filter f_ethernet { - message("eth1") or + (message("eth1") or message("eth2") or message("eth3") or message("eth4") or @@ -18,7 +20,8 @@ filter f_ethernet { message("eth7") or message("eth8") or message("br0:") or - message("br1:"); + message("br1:")) and + not match('IN=eth.* OUT=.* MAC=.*' value("MESSAGE")); }; log { From 45df5989ccafe372e919179a96a1a4fbcfcbc110 Mon Sep 17 00:00:00 2001 From: Martinski4GitHub <119833648+Martinski4GitHub@users.noreply.github.com> Date: Wed, 25 Feb 2026 23:46:57 -0800 Subject: [PATCH 04/10] Code Improvements Some code improvements when updating filter files. --- README.md | 2 +- scribe.sh | 45 ++++++++++++++++++++++++--------------------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index b7fec94..11f34b5 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ **scribe** is a **syslog-ng** and **logrotate** installer for ASUS routers running **Asuswrt-Merlin** ## v3.2.11 -### Updated on 2026-Feb-22 +### Updated on 2026-Feb-25 ## Getting Started diff --git a/scribe.sh b/scribe.sh index 08d4348..e9abf35 100644 --- a/scribe.sh +++ b/scribe.sh @@ -18,7 +18,7 @@ # curl --retry 3 "https://raw.githubusercontent.com/AMTM-OSR/scribe/master/scribe.h" -o "/jffs/scripts/scribe" && chmod 0755 /jffs/scripts/scribe && /jffs/scripts/scribe install # ################################################################## -# Last Modified: 2026-Feb-21 +# Last Modified: 2026-Feb-25 #----------------------------------------------------------------- ################ Shellcheck directives ################ @@ -35,7 +35,7 @@ readonly script_name="scribe" readonly scribe_ver="v3.2.11" -readonly scriptVer_TAG="26022123" +readonly scriptVer_TAG="26022523" scribe_branch="develop" script_branch="$scribe_branch" @@ -2040,21 +2040,24 @@ Menu_Uninstall() esac } +##----------------------------------------## +## Modified by Martinski W. [2026-Feb-25] ## +##----------------------------------------## Menu_Filters() { - printf "\n$white Do you want to update$yellow %s$white and$yellow %s$white filter files?\n" "$sng" "$lr" - printf "$cyan 1) Adds any new files to$yellow %s$cyan directories\n" "$share_ex" - printf " and updates any example files that have changed.\n" - printf " 2) Adds any new files to$yellow %s$cyan directories.\n" "$etc_d" - printf " 3) Asks to update existing files in$yellow %s$cyan directories\n" "$etc_d" - printf "$magenta _IF_$cyan a corresponding file exists in$yellow %s$cyan,\n" "$share_ex" - printf "$magenta _AND_$cyan it is different from the file in$yellow %s$cyan.\n" "$etc_d" - printf "$white NOTE:$cyan You will be provided an opportunity to review\n" - printf " the differences between the existing file and the\n" - printf " proposed update.\n\n" - printf "$yellow If you are unsure, you should answer 'y' here; any changes to\n" - printf " the running configuration will require confirmation.\n\n" - printf "$white Update filter files? [y|n] $std" + printf "\n ${white}Do you want to update ${yellow}%s${white} and ${yellow}%s${white} filter files?\n" "$sng" "$lr" + printf "\n ${cyan}1) Adds any new files to ${yellow}%s${cyan} directories\n" "$share_ex" + printf " and updates any example files that have changed.\n" + printf " 2) Adds any new files to ${yellow}%s${cyan} directories.\n" "$etc_d" + printf " 3) Asks to update existing files in ${yellow}%s${cyan} directories\n" "$etc_d" + printf " ${magenta}_IF_${cyan} a corresponding file exists in ${yellow}%s${cyan},\n" "$share_ex" + printf " ${magenta}_AND_${cyan} it is different from the file in ${yellow}%s${cyan}.\n" "$etc_d" + printf " ${white}NOTE:${cyan} You will be provided an opportunity to review\n" + printf " the differences between the existing file and the\n" + printf " proposed update.\n\n" + printf " ${yellow}If you are unsure, you should answer ${white}'${green}y${white}'${yellow} here; any changes\n" + printf " to the running configuration will require confirmation.\n\n" + printf " ${white}Update filter files? [${green}y${white}|${green}n${white}]${std} " if Yes_Or_No then Get_ZIP_File @@ -2070,19 +2073,19 @@ Menu_Filters() if [ -e "$comp_file" ] && ! Same_MD5_Hash "$upd_file" "$comp_file" then processed=false - printf "\n$white Update available for$yellow %s$white.\n" "$upd_file" + printf "\n ${white}Update available for ${yellow}%s${white}.\n" "$upd_file" while ! $processed do - printf " (a)ccept, (r)eject, or (v)iew diff for this file? " + printf " (${green}a${white})ccept, (${green}r${white})eject, or (${green}v${white})iew diff for this file? " read -r dispo case "$dispo" in a) Update_File "$comp_file" "$upd_file" - printf "\n ${green}%s updated!${std}\n" "$upd_file" + printf "\n ${green}%s was updated!${std}\n" "$upd_file" processed=true ;; r) - printf "\n ${magenta}%s not updated!${std}\n" "$upd_file" + printf "\n ${magenta}%s NOT updated!${std}\n" "$upd_file" processed=true ;; v) @@ -2098,10 +2101,10 @@ Menu_Filters() fi done done - printf "\n ${white}%s and %s example files updated!${std}\n" "$sng" "$lr" + printf "\n ${white}%s and %s example files were updated!${std}\n\n" "$sng" "$lr" Reload_SysLogNg_Config else - printf "\n ${white}%s and %s example files ${red}not${white} updated!${std}\n" "$sng" "$lr" + printf "\n ${white}%s and %s example files ${red}NOT${white} updated!${std}\n\n" "$sng" "$lr" fi } From 8cc906077ece6f0713760a07f1a215394f9df061 Mon Sep 17 00:00:00 2001 From: Martinski4GitHub <119833648+Martinski4GitHub@users.noreply.github.com> Date: Fri, 27 Feb 2026 01:17:17 -0800 Subject: [PATCH 05/10] Improved Ethernet Filter Configuration Improvements in the syslog-ng Ethernet filter configuration file to prevent it from capturing log entries intended for the Skynet/firewall log files. --- syslog-ng.share/ethernet | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/syslog-ng.share/ethernet b/syslog-ng.share/ethernet index 18ceb6e..f9c00e0 100644 --- a/syslog-ng.share/ethernet +++ b/syslog-ng.share/ethernet @@ -1,5 +1,5 @@ # log ethernet change to /opt/var/log/ethernet.log only # -# Last Modified: 2026-Feb-25 # +# Last Modified: 2026-Feb-27 # destination d_ethernet { file("/opt/var/log/ethernet.log"); @@ -11,17 +11,8 @@ filter f_kernel { }; filter f_ethernet { - (message("eth1") or - message("eth2") or - message("eth3") or - message("eth4") or - message("eth5") or - message("eth6") or - message("eth7") or - message("eth8") or - message("br0:") or - message("br1:")) and - not match('IN=eth.* OUT=.* MAC=.*' value("MESSAGE")); + (message('eth[0-9]') or message('br[0-9]:')) and + not match('IN=eth. OUT=' value("MESSAGE")); }; log { From b8738bb15ac0008cb81954e309d2b53303b9e476 Mon Sep 17 00:00:00 2001 From: Martinski4GitHub <119833648+Martinski4GitHub@users.noreply.github.com> Date: Sat, 28 Feb 2026 00:09:26 -0800 Subject: [PATCH 06/10] Code Improvements More code improvements. --- README.md | 2 +- scribe.sh | 39 +++++++++++++++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 11f34b5..da245e3 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ **scribe** is a **syslog-ng** and **logrotate** installer for ASUS routers running **Asuswrt-Merlin** ## v3.2.11 -### Updated on 2026-Feb-25 +### Updated on 2026-Feb-28 ## Getting Started diff --git a/scribe.sh b/scribe.sh index e9abf35..a2cf969 100644 --- a/scribe.sh +++ b/scribe.sh @@ -18,7 +18,7 @@ # curl --retry 3 "https://raw.githubusercontent.com/AMTM-OSR/scribe/master/scribe.h" -o "/jffs/scripts/scribe" && chmod 0755 /jffs/scripts/scribe && /jffs/scripts/scribe install # ################################################################## -# Last Modified: 2026-Feb-25 +# Last Modified: 2026-Feb-27 #----------------------------------------------------------------- ################ Shellcheck directives ################ @@ -35,7 +35,7 @@ readonly script_name="scribe" readonly scribe_ver="v3.2.11" -readonly scriptVer_TAG="26022523" +readonly scriptVer_TAG="26022723" scribe_branch="develop" script_branch="$scribe_branch" @@ -673,6 +673,34 @@ Copy_SysLogNg_RcFunc() finished } +##-------------------------------------## +## Added by Martinski W. [2026-Feb-27] ## +##-------------------------------------## +_Find_WildcardFile_TopConfigLines_() +{ + if [ $# -eq 0 ] || [ -z "$1" ] || [ ! -s "$1" ] + then return 1 + fi + local retCode=0 lineNum lineStr1 lineStr2 lineStr3 lineStr4 + + lineStr1='wildcard_file(base_dir("/opt/var/log")' + lineStr2='filename_pattern("syslogd.ScribeInitReboot.LOG")' + lineStr3='recursive(no) max-files(1) follow_freq(1)' + lineStr4='log_iw_size(1200) log_fetch_limit(1000) flags(syslog-protocol))' + + lineNum=1 + while read -r theLINE && [ -n "$theLINE" ] + do + if ! echo "$theLINE" | grep -qF "$(eval echo '$'"lineStr$lineNum")" + then retCode=1 ; break + fi + lineNum="$((lineNum + 1))" + done < "$diffFile" if [ -s "$diffFile" ] && \ grep -qE "^(\-|\+)" "$diffFile" && \ - [ "$(wc -l < "$diffFile")" -gt 0 ] + [ "$(wc -l < "$diffFile")" -gt 0 ] && \ + ! _Find_WildcardFile_TopConfigLines_ "$destFile" then printf " ${yellow}updating $destFile ..." Update_File "$srceFile" "$destFile" "BACKUP" @@ -2171,8 +2200,10 @@ Update_Version() GetScribeVersion ShowScribeVersion Menu_Update "$@" + return "$?" else not_recog=true + return 1 fi } @@ -2194,7 +2225,7 @@ ScriptUpdateFromAMTM() if [ $# -gt 0 ] && [ "$1" = "check" ] then return 0 fi - Menu_Update force + Update_Version force return "$?" } From b240e5d421c6b2798e042c45145a8bca7e081ab0 Mon Sep 17 00:00:00 2001 From: Martinski4GitHub <119833648+Martinski4GitHub@users.noreply.github.com> Date: Sun, 1 Mar 2026 23:49:51 -0800 Subject: [PATCH 07/10] Discard "debug" Log Messages From "messages" Log Modified top-level syslog-ng configuration file to discard all "debug" log priority level entries from the "messages" log file. --- syslog-ng.share/syslog-ng.conf-scribe | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/syslog-ng.share/syslog-ng.conf-scribe b/syslog-ng.share/syslog-ng.conf-scribe index 2858b5a..86a7de2 100644 --- a/syslog-ng.share/syslog-ng.conf-scribe +++ b/syslog-ng.share/syslog-ng.conf-scribe @@ -1,6 +1,6 @@ ############################################################################# # syslog-ng.conf customized for Scribe on Asuswrt-Merlin firmware -# Last Modified: 2026-Feb-01 +# Last Modified: 2026-Mar-01 # # Compare to /opt/share/syslog-ng/examples/syslog-ng.conf-opkg for # differences from the Entware distribution @@ -54,6 +54,7 @@ log { source(src); # uncomment this and "source s_net" function above to get udp log messages from local network # #OFF# source(s_net); + filter { level(info..emerg); }; destination(messages); # uncomment this and "destination log_server" function above to send udp log messages to local network # #OFF# destination(log_server); From 6569a63fc55316ebb83b75b9b37cdc6a679d3322 Mon Sep 17 00:00:00 2001 From: Martinski4GitHub <119833648+Martinski4GitHub@users.noreply.github.com> Date: Sun, 1 Mar 2026 23:55:55 -0800 Subject: [PATCH 08/10] Discard or Capture "debug" Log Messages - New syslog-ng filter configuration file to discard all "debug" log priority level messages. - New syslog-ng filter configuration file to capture all 'debug' log priority level messages in a separate log file. --- syslog-ng.share/A0DebugMsgsCapture | 19 +++++++++++++++++++ syslog-ng.share/A0DebugMsgsDiscard | 13 +++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 syslog-ng.share/A0DebugMsgsCapture create mode 100644 syslog-ng.share/A0DebugMsgsDiscard diff --git a/syslog-ng.share/A0DebugMsgsCapture b/syslog-ng.share/A0DebugMsgsCapture new file mode 100644 index 0000000..d313853 --- /dev/null +++ b/syslog-ng.share/A0DebugMsgsCapture @@ -0,0 +1,19 @@ +####################################################### +# Capture all incoming log messages that are tagged +# with the 'debug' log priority level. +# /opt/var/log/debugMessages.log +# Last Modified: 2026-Mar-01 +####################################################### + +destination d_DebugLogMsg { + file('/opt/var/log/debugMessages.log'); +}; + +log { + source(src); + filter { level(debug); }; + destination(d_DebugLogMsg); + flags(final); +}; + +#eof# diff --git a/syslog-ng.share/A0DebugMsgsDiscard b/syslog-ng.share/A0DebugMsgsDiscard new file mode 100644 index 0000000..86750b8 --- /dev/null +++ b/syslog-ng.share/A0DebugMsgsDiscard @@ -0,0 +1,13 @@ +####################################################### +# Discard all incoming log messages that are tagged +# with the 'debug' log priority level. +# Last Modified: 2026-Mar-01 +####################################################### + +log { + source(src); + filter { level(debug); }; + flags(final); +}; + +#eof# From e5d2eac01b5df38d84a2ce83d4a24d508ef783de Mon Sep 17 00:00:00 2001 From: Martinski4GitHub <119833648+Martinski4GitHub@users.noreply.github.com> Date: Tue, 3 Mar 2026 00:11:47 -0800 Subject: [PATCH 09/10] Additions and Improvements - Modified top-level syslog-ng configuration file (/opt/etc/syslog-ng.conf) to filter out from the "messages" log file all log entries tagged with the 'debug' severity level. - New CLI menu option to specify how to handle incoming log messages that have been tagged with the 'debug' severity level (i.e. 'debug' log messages). There are 3 settings available: Discard, Capture and Allow. - Modified code to minimize the number of scenarios where the top-level syslog-ng configuration file (/opt/etc/syslog-ng.conf) is overwritten during an add-on version update. The config file will be replaced only under certain conditions when major changes that are not optional have been introduced; otherwise, the file will be left alone. --- README.md | 2 +- scribe.sh | 255 +++++++++++++++++++++++------ syslog-ng.share/A0DebugMsgsCapture | 2 +- syslog-ng.share/A0DebugMsgsDiscard | 2 +- 4 files changed, 211 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index da245e3..bf88928 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ **scribe** is a **syslog-ng** and **logrotate** installer for ASUS routers running **Asuswrt-Merlin** ## v3.2.11 -### Updated on 2026-Feb-28 +### Updated on 2026-Mar-02 ## Getting Started diff --git a/scribe.sh b/scribe.sh index a2cf969..f52e11a 100644 --- a/scribe.sh +++ b/scribe.sh @@ -18,7 +18,7 @@ # curl --retry 3 "https://raw.githubusercontent.com/AMTM-OSR/scribe/master/scribe.h" -o "/jffs/scripts/scribe" && chmod 0755 /jffs/scripts/scribe && /jffs/scripts/scribe install # ################################################################## -# Last Modified: 2026-Feb-27 +# Last Modified: 2026-Mar-02 #----------------------------------------------------------------- ################ Shellcheck directives ################ @@ -35,7 +35,7 @@ readonly script_name="scribe" readonly scribe_ver="v3.2.11" -readonly scriptVer_TAG="26022723" +readonly scriptVer_TAG="26030223" scribe_branch="develop" script_branch="$scribe_branch" @@ -190,17 +190,18 @@ readonly syslogNgStr="syslog-ng" readonly logRotateStr="logrotate" readonly syslogNgCmd="/opt/sbin/$syslogNgStr" readonly logRotateCmd="/opt/sbin/$logRotateStr" -readonly logRotateDir="/opt/etc/${logRotateStr}.d" +readonly logRotateConfDir="/opt/etc/${logRotateStr}.d" readonly logRotateShareDir="/opt/share/$logRotateStr" readonly logRotateExamplesDir="${logRotateShareDir}/examples" readonly logRotateTopConfig="/opt/etc/${logRotateStr}.conf" readonly logRotateGlobalName="A01global" -readonly logRotateGlobalConf="${logRotateDir}/$logRotateGlobalName" +readonly logRotateGlobalConf="${logRotateConfDir}/$logRotateGlobalName" readonly LR_FLock_FD=513 readonly LR_FLock_FName="/tmp/scribeLogRotate.flock" readonly logFilesRegExp="${optVarLogDir}/.*([.]log)?" readonly filteredLogList="${config_d}/.filteredlogs" readonly noConfigLogList="${config_d}/.noconfiglogs" +readonly syslogNg_ConfDir="/opt/etc/${syslogNgStr}.d" readonly syslogNg_ShareDir="/opt/share/$syslogNgStr" readonly syslogNg_ExamplesDir="${syslogNg_ShareDir}/examples" readonly syslogNg_ConfName=${syslogNgStr}.conf @@ -212,6 +213,13 @@ readonly sysLogLinesMAX=20480 readonly sysLogMsgeSizeMAX=2048 sysLogFiFoSizeMIN=1600 +readonly debugMsgDiscardFilterName="A0DebugMsgsDiscard" +readonly debugMsgDiscardFilterConf="${syslogNg_ConfDir}/$debugMsgDiscardFilterName" +readonly debugMsgDiscardFilterSrce="${syslogNg_ExamplesDir}/$debugMsgDiscardFilterName" +readonly debugMsgCaptureFilterName="A0DebugMsgsCapture" +readonly debugMsgCaptureFilterConf="${syslogNg_ConfDir}/$debugMsgCaptureFilterName" +readonly debugMsgCaptureFilterSrce="${syslogNg_ExamplesDir}/$debugMsgCaptureFilterName" + # color constants # readonly red="\033[1;31m" readonly green="\033[1;32m" @@ -533,6 +541,10 @@ Read_Config() then _Config_Option_Update_ LR_CRONJOB_HOUR 24 fi + if ! _Config_Option_Check_ DEBUG_LOG_LEVEL_MSG + then + _Config_Option_Update_ DEBUG_LOG_LEVEL_MSG Allowed + fi if ! _Config_Option_Check_ FILTER_INIT_REBOOT_LOG then _Config_Option_Update_ FILTER_INIT_REBOOT_LOG true @@ -648,12 +660,19 @@ Get_ZIP_File() fi } +##----------------------------------------## +## Modified by Martinski W. [2026-Mar-02] ## +##----------------------------------------## Restart_uiScribe() { + local from="" if "$uiScribeInstalled" then printf "\n$white Restarting ${uiscribeName}...\n" - $uiscribePath startup + if [ $# -gt 0 ] && [ "$1" = "true" ] + then from="Scribe" + fi + $uiscribePath startup $from fi } @@ -662,7 +681,7 @@ Reload_SysLogNg_Config() printf "$white reloading %s ... $cyan" "$( strip_path $sng_conf )" $sngctl_loc reload printf "\n$std" - Restart_uiScribe + Restart_uiScribe "$@" } Copy_SysLogNg_RcFunc() @@ -676,19 +695,20 @@ Copy_SysLogNg_RcFunc() ##-------------------------------------## ## Added by Martinski W. [2026-Feb-27] ## ##-------------------------------------## -_Find_WildcardFile_TopConfigLines_() +_TopLevelConfigLinesCheck_() { if [ $# -eq 0 ] || [ -z "$1" ] || [ ! -s "$1" ] then return 1 fi - local retCode=0 lineNum lineStr1 lineStr2 lineStr3 lineStr4 + local retCode=0 lineNum=1 + local lineStr1 lineStr2 lineStr3 lineStr4 lineStr5 lineStr1='wildcard_file(base_dir("/opt/var/log")' lineStr2='filename_pattern("syslogd.ScribeInitReboot.LOG")' lineStr3='recursive(no) max-files(1) follow_freq(1)' lineStr4='log_iw_size(1200) log_fetch_limit(1000) flags(syslog-protocol))' - - lineNum=1 + lineStr5='filter \{ level\((info|debug)..emerg\); \}' + while read -r theLINE && [ -n "$theLINE" ] do if ! echo "$theLINE" | grep -qF "$(eval echo '$'"lineStr$lineNum")" @@ -698,6 +718,11 @@ _Find_WildcardFile_TopConfigLines_() done < "$noConfigLogList" @@ -2229,7 +2364,7 @@ ScriptUpdateFromAMTM() return "$?" } -menu_forgrnd() +SyslogNg_DebugMode() { local doStart=false if SyslogNg_Running @@ -2706,29 +2841,40 @@ EOF } ##----------------------------------------## -## Modified by Martinski W. [2025-Jan-04] ## +## Modified by Martinski W. [2026-Mar-02] ## ##----------------------------------------## Utils_Menu() { - printf "$magenta %s Utilities ${CLRct}\n\n" "$script_name" - printf " ${GRNct}bu${CLRct}. Backup configuration files\n" - printf " ${GRNct}rt${CLRct}. Restore configuration files\n\n" - printf " ${GRNct}d${CLRct}. Generate debug file\n" - printf " ${GRNct}rd${CLRct}. Re-detect syslog.log location\n" - printf " ${GRNct}ck${CLRct}. Check on-disk %s config\n" "$sng" + local debugLogMsgOpt debugLogMsgOptStr="UNKNOWN" + + debugLogMsgOpt="$(_Config_Option_Get_ DEBUG_LOG_LEVEL_MSG)" + case "$debugLogMsgOpt" in + Discard) debugLogMsgOptStr="Discarded" ;; + Capture) debugLogMsgOptStr="Captured" ;; + Allowed) debugLogMsgOptStr="Allowed" ;; + esac + + printf " ${magenta}%s Utilities${CLRct}\n\n" "$script_name" + printf " ${GRNct}bu${CLRct}. Backup configuration files\n" + printf " ${GRNct}rt${CLRct}. Restore configuration files\n\n" + printf " ${GRNct}d${CLRct}. Generate %s debug file\n" "$script_name" + printf " ${GRNct}rd${CLRct}. Re-detect syslog.log location\n" if SyslogNg_Running then - printf " ${GRNct}lc${CLRct}. Show loaded %s config\n" "$sng" + printf " ${GRNct}lc${CLRct}. Show loaded %s configuration\n" "$sng" fi - printf " ${GRNct}sd${CLRct}. Run %s debugging mode\n" "$sng" - printf " ${GRNct}ld${CLRct}. Show %s debug info\n\n" "$lr" - printf " ${GRNct}ui${CLRct}. " + printf " ${GRNct}ck${CLRct}. Check on-disk %s configuration\n" "$sng" + printf " ${GRNct}sd${CLRct}. Run %s in debugging mode\n" "$sng" + printf " ${GRNct}ld${CLRct}. Show %s debugging information\n" "$lr" + printf " ${GRNct}dm${CLRct}. Messages with 'debug' severity level\n" + printf " [Currently: ${GRNct}${debugLogMsgOptStr}${CLRct}]\n\n" + printf " ${GRNct}ui${CLRct}. " if "$uiScribeInstalled" then printf "Run" else printf "Install" fi printf " %s\n" "$uiscribeName" - printf " ${GRNct}e${CLRct}. Exit to Main Menu\n" + printf " ${GRNct}e${CLRct}. Exit to Main Menu\n" } ##----------------------------------------## @@ -2747,7 +2893,7 @@ Main_Menu() else insPrefix="Rei" fi fi - andLRcron="& $lr cron" + andLRcron="& $lr cron job" if "$scribeInstalled" then @@ -2755,39 +2901,39 @@ Main_Menu() then _ShowSysLogNg_WaitStart_Msge_ fi - printf " ${GRNct}s${CLRct}. Show %s status\n" "$script_name" + printf " ${GRNct}s${CLRct}. Show %s status\n" "$script_name" if SyslogNg_Running then - printf " ${GRNct}rl${CLRct}. Reload %s.conf\n" "$sng" - printf " ${GRNct}lr${CLRct}. Run logrotate now\n" + printf " ${GRNct}lr${CLRct}. Run logrotate now\n" fi if SyslogNg_Running || [ ! -f "$syslogNg_WaitnSEM_FPath" ] then - printf " ${GRNct}rs${CLRct}. %s %s " "${resPrefix}tart" "$sng" + printf " ${GRNct}rs${CLRct}. %s %s " "${resPrefix}tart" "$sng" SyslogNg_Running && echo || printf "${andLRcron}\n" fi if SyslogNg_Running then - printf " ${GRNct}st${CLRct}. Stop %s ${andLRcron}\n" "$sng" - printf " ${GRNct}ct${CLRct}. Set $lr cron job run frequency\n\n" - printf " ${GRNct}u${CLRct}. Check for script updates\n" - printf " ${GRNct}uf${CLRct}. Force update %s with latest version\n" "$script_name" - printf " ${GRNct}ft${CLRct}. Update filters\n" + printf " ${GRNct}rl${CLRct}. Reload %s configuration\n" "$sng" + printf " ${GRNct}st${CLRct}. Stop %s ${andLRcron}\n" "$sng" + printf " ${GRNct}ct${CLRct}. Set $lr cron job run frequency\n\n" + printf " ${GRNct}u${CLRct}. Check for latest script updates\n" + printf " ${GRNct}uf${CLRct}. Force update %s with latest version\n" "$script_name" + printf " ${GRNct}ft${CLRct}. Update filters\n" fi if [ -f "$syslogNg_WaitnSEM_FPath" ] then echo else - printf " ${GRNct}su${CLRct}. %s utilities\n\n" "$script_name" + printf " ${GRNct}su${CLRct}. %s utilities\n\n" "$script_name" fi fi - printf " ${GRNct}e${CLRct}. Exit %s\n" "$script_name" - printf " ${GRNct}is${CLRct}. %s %s\n" "${insPrefix}nstall" "$script_name" - printf " ${GRNct}zs${CLRct}. Remove %s\n" "$script_name" + printf " ${GRNct}e${CLRct}. Exit %s\n" "$script_name" + printf " ${GRNct}is${CLRct}. %s %s\n" "${insPrefix}nstall" "$script_name" + printf " ${GRNct}zs${CLRct}. Remove %s\n" "$script_name" } ##----------------------------------------## -## Modified by Martinski W. [2025-Dec-05] ## +## Modified by Martinski W. [2026-Mar-01] ## ##----------------------------------------## Scribe_Menu() { @@ -2807,7 +2953,7 @@ Scribe_Menu() ;; esac printf "\n$menuSepStr" - printf "$magenta Please select an option: $std" + printf " ${magenta}Please select an option:${std} " read -r choice if "$scribeInstalled" || \ @@ -2852,7 +2998,7 @@ Scribe_Menu() ct) if SyslogNg_Running then - menu_LogRotate_CronJob_Time + Menu_LogRotate_CronJob_Time [ $? -ne 0 ] && pause=false else not_recog=true @@ -2873,8 +3019,13 @@ Scribe_Menu() fi ;; su) - menu_type="utils" - pause=false + if [ "$menu_type" = "main" ] + then + menu_type="utils" + pause=false + else + not_recog=true + fi ;; bu) menu_backup @@ -2904,7 +3055,17 @@ Scribe_Menu() fi ;; sd) - menu_forgrnd + SyslogNg_DebugMode + ;; + dm) if SyslogNg_Running && \ + [ "$menu_type" = "utils" ] + then + if ! DebugLogLevelMsgHandling + then pause=false + fi + else + not_recog=true + fi ;; ld) delfr "$lr_temp" @@ -2932,7 +3093,7 @@ Scribe_Menu() e) if [ "$menu_type" = "main" ] then - printf "\n$white Thanks for using scribe! $std\n\n\n" + printf "\n ${white}Thanks for using scribe!${std}\n\n\n" exit 0 else menu_type="main" diff --git a/syslog-ng.share/A0DebugMsgsCapture b/syslog-ng.share/A0DebugMsgsCapture index d313853..3abf6f5 100644 --- a/syslog-ng.share/A0DebugMsgsCapture +++ b/syslog-ng.share/A0DebugMsgsCapture @@ -1,6 +1,6 @@ ####################################################### # Capture all incoming log messages that are tagged -# with the 'debug' log priority level. +# with the 'debug' severity level. # /opt/var/log/debugMessages.log # Last Modified: 2026-Mar-01 ####################################################### diff --git a/syslog-ng.share/A0DebugMsgsDiscard b/syslog-ng.share/A0DebugMsgsDiscard index 86750b8..68989ec 100644 --- a/syslog-ng.share/A0DebugMsgsDiscard +++ b/syslog-ng.share/A0DebugMsgsDiscard @@ -1,6 +1,6 @@ ####################################################### # Discard all incoming log messages that are tagged -# with the 'debug' log priority level. +# with the 'debug' severity level. # Last Modified: 2026-Mar-01 ####################################################### From 6aad84934e6c5f64cdff96b05e4751130c8d1f59 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Mar 2026 00:19:22 +0000 Subject: [PATCH 10/10] Bump softprops/action-gh-release in the all-actions group Bumps the all-actions group with 1 update: [softprops/action-gh-release](https://github.com/softprops/action-gh-release). Updates `softprops/action-gh-release` from 2.5.0 to 2.6.0 - [Release notes](https://github.com/softprops/action-gh-release/releases) - [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md) - [Commits](https://github.com/softprops/action-gh-release/compare/v2.5.0...v2.6.0) --- updated-dependencies: - dependency-name: softprops/action-gh-release dependency-version: 2.6.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: all-actions ... Signed-off-by: dependabot[bot] --- .github/workflows/Create-NewReleases.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Create-NewReleases.yml b/.github/workflows/Create-NewReleases.yml index af5240b..ad666e2 100644 --- a/.github/workflows/Create-NewReleases.yml +++ b/.github/workflows/Create-NewReleases.yml @@ -97,7 +97,7 @@ jobs: # 7--- Publish a GitHub Release with auto-generated notes - name: Create Release with Automated Release Notes - uses: softprops/action-gh-release@v2.5.0 + uses: softprops/action-gh-release@v2.6.0 with: token: ${{ secrets.GITHUB_TOKEN }} tag_name: ${{ steps.nextver.outputs.tag }}