Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**scribe** is a **syslog-ng** and **logrotate** installer for ASUS routers running **Asuswrt-Merlin**

## v3.2.9
### Updated on 2026-Jan-29
### Updated on 2026-Jan-30

## Getting Started

Expand Down
37 changes: 30 additions & 7 deletions init.d/rc.func.syslog-ng
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/sh -
#
# NB: rc.func only runs PRECMD on "start"
# Last Modified: 2026-Jan-25
# VERSION="3.1.4"
# Last Modified: 2026-Jan-27
# VERSION="3.1.5"
#-------------------------------------------

## Run the F/W built-in native commands ##
Expand All @@ -21,12 +21,14 @@ logTagStr="scribe:kill_logger[$$]"
logPrioNum="-p 4"

##----------------------------------------##
## Modified by Martinski W. [2026-Jan-25] ##
## Modified by Martinski W. [2026-Jan-30] ##
##----------------------------------------##
kill_logger()
{
local serviceCallOK prevSysLog_Loc messagesLogSAVED
local scribeScriptFPath="/jffs/scripts/scribe"
local booleanStr=false filterSyslogInitRebootLogMsgs=true
local syslogD_InitRebootLogPath="/opt/var/log/syslogd.ScribeInitReboot.LOG"
local syslogNG_WaitnSEM_FPath="/tmp/var/tmp/scribe_SysLogNg.WAITN.SEM"
local syslogNG_StartSEM_FPath="/tmp/var/tmp/scribe_SysLogNg.START.SEM"

Expand Down Expand Up @@ -55,14 +57,14 @@ kill_logger()
[ -z "$script_conf" ] && script_conf="/jffs/addons/scribe.d/config"
isjffs=false
prevSysLog_Loc="$syslog_loc"
messagesLogSAVED="${optmsg}.SAVED.LOG"
messagesLogSAVED="${optmsg}.Scribe_SAVED.LOG"

# Figure out where syslogd expects log file to live #
if [ -z "$syslog_loc" ] # do NOT look for config file if $syslog_loc is defined #
then
if [ -s "$script_conf" ] && $grepCmd -q "^SYSLOG_LOC=" "$script_conf"
then
syslog_loc="$($grepCmd "^SYSLOG_LOC=" "$script_conf" | $cutCmd -f2 -d'=')"
syslog_loc="$($grepCmd "^SYSLOG_LOC=" "$script_conf" | $cutCmd -d'=' -f2)"
elif [ -n "$($pidofCmd syslogd)" ]
then
findStr="$($psCmd ww | $grepCmd '/syslogd' | $grepCmd -oE '\-O .*/syslog.log')"
Expand All @@ -79,6 +81,16 @@ kill_logger()
fi
fi

if [ -s "$script_conf" ] && \
$grepCmd -q "^FILTER_INIT_REBOOT_LOG=" "$script_conf"
then
booleanStr="$($grepCmd "^FILTER_INIT_REBOOT_LOG=" "$script_conf" | $cutCmd -d'=' -f2)"
fi
if [ "$booleanStr" = "true" ]
then filterSyslogInitRebootLogMsgs=true
else filterSyslogInitRebootLogMsgs=false
fi

if "$serviceCallOK"
then
$loggerCmd -t "$logTagStr" $logPrioNum "optmsg=[$optmsg]"
Expand Down Expand Up @@ -131,15 +143,26 @@ kill_logger()
$rmCmd -f "$messagesLogSAVED"
fi
log1Msg="### Top of Log File ###"
printf '' > "$syslogD_InitRebootLogPath"

if [ ! -d "${syslog_loc}-1" ] && \
[ ! -L "${syslog_loc}-1" ] && \
[ -s "${syslog_loc}-1" ] && \
[ "$(head -n1 "${syslog_loc}-1")" != "$log1Msg" ] && \
[ "$(tail -n1 "${syslog_loc}-1")" != "$log1Msg" ]
then ## Transfer 1st part of the system log ##
$catCmd "${syslog_loc}-1" >> "$optmsg"
if ! "$filterSyslogInitRebootLogMsgs"
then $catCmd "${syslog_loc}-1" >> "$optmsg"
else $catCmd "${syslog_loc}-1" > "$syslogD_InitRebootLogPath"
fi
fi
if [ -s "$syslog_loc" ]
then
if ! "$filterSyslogInitRebootLogMsgs"
then $catCmd "$syslog_loc" >> "$optmsg"
else $catCmd "$syslog_loc" >> "$syslogD_InitRebootLogPath"
fi
fi
[ -s "$syslog_loc" ] && $catCmd "$syslog_loc" >> "$optmsg"
$rmCmd -f "$syslog_loc" "${syslog_loc}-1"
$lnCmd -snf "$optmsg" "$syslog_loc"
echo "$log1Msg" > "${syslog_loc}-1"
Expand Down
Loading