System log - 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:

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. :frowning:

Does it use the output of logread cmd?
Could that be flipped?

loglines.join('\n') => loglines.reverse().join('\n')

1 Like

Thanks. That seems to be enough. No need to have "tac" in busybox :wink:

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.

In case you want to edit that in a live router, just edit that loglines join command in

The ACL specifies the exact command line that may be used

You need to adjust that accordingly and restart rpcd.

Implemented and tested ok.

Thanks team!

1 Like

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.

I think that last 50 lines could be implemented two ways.

  • Define new ACL command, logread last 50 lines and use it. Smaller data set from router, less computation on client side, but longer ACL list.
  • Fetch full logread wth current ACL, then on client side use JavaScript slice(-50) to tail it before reverse. More computation, but shorter ACL list.

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:

  • Chrome browser
  • Firefox

Does not reverse output:

  • MS Edge (Chromium) browser

Can we add this to the base system as a feature? I add it to every build each time.

1 Like