logmngr: multiple fixes

- Fix regression in generating log-rotate policy
- Fix logread output in case of file rotation
This commit is contained in:
Vivek Kumar Dutta 2025-03-24 18:02:52 +05:30
parent f2c665a0cf
commit 2a47619b32
No known key found for this signature in database
GPG key ID: 4E09F5AD8265FD4C
4 changed files with 19 additions and 20 deletions

View file

@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=logmngr
PKG_VERSION:=1.0.13
PKG_VERSION:=1.0.14
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)

View file

@ -1,13 +1,12 @@
#!/bin/sh
if [ -s "/etc/config/logmngr" ]; then
if uci -q get logmngr.@globals[0] >/dev/null; then
# return if there is any valid content
exit
else
rm -f /etc/config/logmngr
fi
if uci -q get logmngr.@globals[0] >/dev/null; then
# return if there is any valid content
exit 0
else
rm -f /etc/config/logmngr
fi
touch /etc/config/logmngr
uci set logmngr.globals=globals

View file

@ -1,13 +1,13 @@
#!/bin/sh
if [ -s "/etc/config/logmngr" ]; then
if uci -q get logmngr.@log_rotate[0] >/dev/null; then
# return if there is any valid content
exit
fi
uci set logmngr.lro1=log_rotate
uci set logmngr.lro1.enable=1
uci set logmngr.lro1.file_name="/var/log/messages"
uci set logmngr.lro1.file_count=1
uci set logmngr.lro1.max_file_size=1000000
# Adds a default log rotate policy if none exists
if uci -q get logmngr.@log_rotate[0] >/dev/null; then
# return if there is any valid content
exit 0
fi
uci set logmngr.lro1=log_rotate
uci set logmngr.lro1.enable=1
uci set logmngr.lro1.file_name="/var/log/messages"
uci set logmngr.lro1.file_count=1
uci set logmngr.lro1.max_file_size=1000000

View file

@ -89,13 +89,13 @@ else
exit 0
;;
-f)
tail -f "${logfile}"
tail -F "${logfile}"
exit 0
;;
-fe)
shift
pattern="${1}"
tail -f "${logfile}" | grep -E "${pattern}"
tail -F "${logfile}" | grep -E "${pattern}"
exit 0
;;
-h|*)