luci-mod-status: fix syslog page with syslog-ng
authorRamon Van Gorkom <redacted>
Sun, 8 Mar 2026 13:45:19 +0000 (14:45 +0100)
committerPaul Donald <redacted>
Mon, 16 Mar 2026 22:22:31 +0000 (23:22 +0100)
If you have syslog-ng installed instead of logd then
syslog page displays errors.
This commit fixes that.

Signed-off-by: Ramon Van Gorkom <redacted>
modules/luci-base/htdocs/luci-static/resources/tools/views.js
modules/luci-mod-status/root/usr/share/rpcd/acl.d/luci-mod-status.json

index 91699a48e6befc078dea5e6d513ff6184a724081..8bbd9fa76a6930579b752bd062c793f9a77fcfcb 100644 (file)
@@ -2,6 +2,7 @@
 'require poll';
 'require rpc';
 'require uci';
+'require fs';
 'require ui';
 'require view';
 
@@ -74,21 +75,34 @@ var CBILogreadBox = function(logtag, name) {
                                const tz = uci.get('system', '@system[0]', 'zonename')?.replaceAll(' ', '_');
                                const ts = uci.get('system', '@system[0]', 'clock_timestyle') || 0;
                                const hc = uci.get('system', '@system[0]', 'clock_hourcycle') || 0;
-                               const logEntries = await callLogRead(this.fetchMaxRows, false, true);
-                               const dateObj = new Intl.DateTimeFormat(undefined, {
-                                               dateStyle: 'medium',
-                                               timeStyle: (ts == 0) ? 'long' : 'full',
-                                               hourCycle: (hc == 0) ? undefined : hc,
-                                               timeZone: tz
-                               });
+                               let loglines = await callLogRead(this.fetchMaxRows, false, true)
+                                       .then((logEntries) => {
+                                               const dateObj = new Intl.DateTimeFormat(undefined, {
+                                                               dateStyle: 'medium',
+                                                               timeStyle: (ts == 0) ? 'long' : 'full',
+                                                               hourCycle: (hc == 0) ? undefined : hc,
+                                                               timeZone: tz
+                                               });
 
-                               let loglines = logEntries.map(entry => {
-                                       const time = new Date(entry?.time);
-                                       const datestr = dateObj.format(time);
-                                       /* remember to add one since the 'any' entry occupies 1st position i.e. [0] */
-                                       const facility = this.facilities[Math.floor(entry?.priority / 8) + 1][1] ?? 'unknown';
-                                       const severity = this.severity[(entry?.priority % 8) + 1][1] ?? 'unknown';
-                                       return `[${datestr}] ${facility}.${severity}: ${entry?.msg}`;
+                                               return logEntries.map(entry => {
+                                                       const time = new Date(entry?.time);
+                                                       const datestr = dateObj.format(time);
+                                                       /* remember to add one since the 'any' entry occupies 1st position i.e. [0] */
+                                                       const facility = this.facilities[Math.floor(entry?.priority / 8) + 1][1] ?? 'unknown';
+                                                       const severity = this.severity[(entry?.priority % 8) + 1][1] ?? 'unknown';
+                                                       return `[${datestr}] ${facility}.${severity}: ${entry?.msg}`;
+                                               });
+                                       })              
+                               .catch(function (){
+                                       return Promise.all([
+                                               L.resolveDefault(fs.stat('/usr/libexec/syslog-wrapper'), null),
+                                       ]).then((stat) => {
+                                               const logger = stat[0]?.path;
+                                               return fs.exec_direct(logger)
+                                                       .then(logdata => {
+                                                               return logdata.trim().split(/\n/);
+                                               });
+                                       });
                                });
 
                                loglines = loglines.filter(line => {
index 341a1b62ff639427c0787c0f541f3ce196bd2a69..b1d2b8f709e027f73ab72e9dbe308b6d08966e6d 100644 (file)
                "read": {
                        "cgi-io": [ "exec" ],
                        "file": {
-                               "/bin/dmesg -r": [ "exec" ]
+                               "/bin/dmesg -r": [ "exec" ],
+                               "/usr/libexec/syslog-wrapper": [ "exec" ]
                        },
                        "ubus": {
-                               "log": [ "read" ]
+                               "log": [ "read" ],
+                               "file": [ "stat" ]
                        }
                }
        },
git clone https://git.99rst.org/PROJECT