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
@@ -1,7 +1,7 @@
# uiScribe

## v1.4.10
### Updated on 2025-Dec-13
### Updated on 2025-Dec-16

## About
uiScribe updates the System Log page to show log files created by Scribe (syslog-ng). Requires [**Scribe**](https://github.com/cynicastic/scribe)
Expand Down
51 changes: 32 additions & 19 deletions uiScribe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
## Forked from https://github.com/jackyaz/uiScribe ##
## ##
########################################################
# Last Modified: 2025-Dec-13
# Last Modified: 2025-Dec-16
#-------------------------------------------------------

########### Shellcheck directives ##########
Expand All @@ -30,7 +30,7 @@
### Start of script variables ###
readonly SCRIPT_NAME="uiScribe"
readonly SCRIPT_VERSION="v1.4.10"
readonly SCRIPT_VERSTAG="25121300"
readonly SCRIPT_VERSTAG="25121623"
SCRIPT_BRANCH="develop"
SCRIPT_REPO="https://raw.githubusercontent.com/AMTM-OSR/$SCRIPT_NAME/$SCRIPT_BRANCH"
readonly SCRIPT_DIR="/jffs/addons/${SCRIPT_NAME}.d"
Expand Down Expand Up @@ -424,27 +424,35 @@ Create_Dirs()
}

##----------------------------------------##
## Modified by Martinski W. [2025-Dec-05] ##
## Modified by Martinski W. [2025-Dec-13] ##
##----------------------------------------##
_Generate_ListOf_Filtered_LogFiles_()
{
local tmpLogList="${HOMEdir}/tempLogs_$$.txt"
local tmpSysLogList="${HOMEdir}/${SCRIPT_NAME}_tempSysLogList_$$.txt"
local tmpFilterList="${HOMEdir}/${SCRIPT_NAME}_tempFltLogList_$$.txt"

printf '' > "$tmpFilterList"
[ ! -f "$filteredLogList" ] && printf '' > "$filteredLogList"

printf '' > "$filteredLogList"
if "$syslogNgCmd" --preprocess-into="$tmpLogList"
if "$syslogNgCmd" --preprocess-into="$tmpSysLogList"
then
while read -r theLINE && [ -n "$theLINE" ]
do
logFilePath="$(echo "$theLINE" | sed -e 's/^[ ]*file("//;s/".*$//')"
if grep -qE "^${logFilePath}$" "$filteredLogList"
if grep -qE "^${logFilePath}$" "$tmpFilterList"
then continue #Avoid duplicates#
fi
echo "$logFilePath" >> "$filteredLogList"
echo "$logFilePath" >> "$tmpFilterList"
done <<EOT
$(grep -A 1 "^destination" "$tmpLogList" | grep -E '[[:blank:]]*file\("/' | grep -v '.*/log/messages')
$(grep -A 1 "^destination" "$tmpSysLogList" | grep -E '[[:blank:]]*file\("/' | grep -v '.*/log/messages')
EOT
fi
rm -f "$tmpLogList"

if ! diff -q "$tmpFilterList" "$filteredLogList" >/dev/null 2>&1
then
mv -f "$tmpFilterList" "$filteredLogList"
fi
rm -f "$tmpSysLogList" "$tmpFilterList"
}

##-------------------------------------##
Expand Down Expand Up @@ -955,9 +963,9 @@ _RotateAllLogFiles_Preamble_()
fi
cp -fp "$logRotateGlobalConf" "${SCRIPT_DIR}/${logRotateGlobalName}.SAVED"

lineNumEndin="$(grep -wn "endscript" "$logRotateGlobalConf" | cut -d':' -f1)"
lineNumBegin="$(grep -wn "postrotate" "$logRotateGlobalConf" | cut -d':' -f1)"
if [ -z "$lineNumEndin" ] || [ -z "$lineNumEndin" ]
lineNumEndin="$(grep -wn -m1 "^endscript" "$logRotateGlobalConf" | cut -d':' -f1)"
lineNumBegin="$(grep -wn -m1 "^postrotate" "$logRotateGlobalConf" | cut -d':' -f1)"
if [ -z "$lineNumBegin" ] || [ -z "$lineNumEndin" ]
then return 1
fi
lineNumEndin="$((lineNumEndin + 1))"
Expand Down Expand Up @@ -1026,9 +1034,10 @@ _Set_LogRotateClear_ConfigOptions_()
{
cat << 'EOF'
{
hourly
daily
size 0k
rotate 9
rotate 25
maxage 25
compress
create
dateext
Expand All @@ -1054,6 +1063,7 @@ _Set_LogRotate_ConfigOptions_()
minsize 512k
maxsize 4096k
rotate 4
maxage 30
compress
delaycompress
create
Expand Down Expand Up @@ -1740,13 +1750,16 @@ else SCRIPT_VERS_INFO="[$versionDev_TAG]"
fi

##----------------------------------------##
## Modified by Martinski W. [2025-Jun-15] ##
## Modified by Martinski W. [2025-Dec-13] ##
##----------------------------------------##
if [ $# -eq 0 ] || [ -z "$1" ]
then
NTP_Ready
Entware_Ready
sed -i '/\/dev\/null/d' "$userCheckLogList"
if grep -qF '/dev/null' "$userCheckLogList"
then
sed -i '/\/dev\/null/d' "$userCheckLogList"
fi
Create_Dirs
Create_Symlinks
Auto_Startup create 2>/dev/null
Expand Down Expand Up @@ -1786,15 +1799,15 @@ case "$1" in
Update_Version force unattended
elif echo "$3" | grep -qE "^${SCRIPT_NAME}RotateLog_.*"
then
logFileName="$(echo "$3" | cut -d'_' -f2)"
logFileName="$(echo "$3" | cut -d'_' -f2-)"
if _AcquireFLock_ nonblock
then
_Run_RotateLogFile_ "$logFileName"
_ReleaseFLock_
fi
elif echo "$3" | grep -qE "^${SCRIPT_NAME}ClearLog_.*"
then
logFileName="$(echo "$3" | cut -d'_' -f2)"
logFileName="$(echo "$3" | cut -d'_' -f2-)"
if _AcquireFLock_ nonblock
then
_Run_ClearLogFile_ "$logFileName"
Expand Down