Hi Team,
Under 'Status - System Log'
Is there a way to reverse the output of the System Log?
I would like to flip the log so the latest lines appear at the top of the output (newest to oldest).
Hi Team,
Under 'Status - System Log'
Is there a way to reverse the output of the System Log?
I would like to flip the log so the latest lines appear at the top of the output (newest to oldest).
Not implemented.
Looking at the source code, I think that it would be rather simple to enable for your own build:
fs.exec_direct('/sbin/logread'
fs.exec_direct('/sbin/logread | tac'
I haven't tested it, but I think that that should be enough.
Doesn't quite work that way. The fs.exec_direct
does not take pipe to the command itself.
Does it use the output of logread cmd?
Could that be flipped?
loglines.join('\n')
=> loglines.reverse().join('\n')
Thanks. That seems to be enough. No need to have "tac" in busybox
But curiously, when I try to add new options to limit the logread output to 50 last lines (-l 50), the additional '-l','50'
to the logread option list, it gives me an ACL error.
@dk4dk4
In case you want to edit that in a live router, just edit that loglines join command in
/www/luci-static/resources/view/status/syslog.js
The ACL specifies the exact command line that may be used https://github.com/openwrt/luci/blob/master/modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json#L51
You need to adjust that accordingly and restart rpcd
.
Thanks Jo. I had not stumbled into that ACL aspect of the client side implementation earlier.
I think that having the last 50 log lines that way might actually be an interesting feature as a separate menu item. (It would be mobile-friendly.) I will likely add that to my own builds.
@jow
I think that last 50 lines could be implemented two ways.
I am thinking that on the longer perspective, which approach is more preferable? Do we have preference for keeping the ACL list size small? Or is it better to allow it to grow if that eases computation.
I am not only thinking in context of this feature, but generally.
I'm loving the reverse system log. Its so much more user friendly with recent data at the top...
Thanks again for the tip. Perhaps an option flag that allows users to select which way they prefer vs. modifying a line of code...
I noticed the reverse() works in:
Does not reverse output:
Can we add this to the base system as a feature? I add it to every build each time.