OPNsense Forum

English Forums => Development and Code Review => Topic started by: Northguy on March 15, 2019, 10:33:49 am

Title: [SOLVED] Browsing Log files for entries older than the last 50 lines
Post by: Northguy on March 15, 2019, 10:33:49 am
Hi,

General question regarding the Log files in OPNsense.

All "log file"  pages show the latest 50 lines (as per setting in diag_logs_template.inc). There is a search box present to search for other lines (if you know what to search for), but is there a way to browse log entries older than the latest 50 lines? I cannot find it.

If there is no other option, it would be nice to have a 'next'  button to show the next batch of 50 lines, or a [1] [2] [3] [4] navigation in order to browse each set of 50 lines.
Title: Re: Browsing Log files for entries older than the last 50 lines
Post by: fabian on March 15, 2019, 11:13:18 pm
I made one for my nginx plugin which allows this but it has some other unintended effects like browser freezes on really big files in some setups (for example a user had a 40M log which was downloaded and then rendered in x entries per page with a forward and backward button.
Title: Re: Browsing Log files for entries older than the last 50 lines
Post by: Northguy on March 17, 2019, 04:44:33 pm
Hi Fabian,

So it is not available for the general log pages. Do you mean with your reply that you find it a bad idea to implement such a feature in overall OPNsense?
Title: Re: Browsing Log files for entries older than the last 50 lines
Post by: fabian on March 17, 2019, 09:32:09 pm
It depends. First of all it depends on libraries which are not in core and secondary it depends on the log size.

For example nginx, haproxy, squid and similar tools will very likely produce huge logs while most other services will only write few lines where no paging is needed. The viewer in the nginx plugin does not only have much more features like filtering by each column which effectively binds it to the data it gets, it also works with structured lines instead of simple date / text formats. The standard log viewer cannot do this because it does not understand the log format (just a string split) and no parsing of structured data.
Title: Re: Browsing Log files for entries older than the last 50 lines
Post by: franco on March 18, 2019, 08:43:57 am
You can change the number of lines shown under System: Settings: Logging for all log viewers. You can also reverse the display order.

Pagination has never been supported. It would make sense to add it, but not without starting to replace more of the logging code with MVC equivalents for future use.


Cheers,
Franco
Title: Re: Browsing Log files for entries older than the last 50 lines
Post by: Northguy on March 18, 2019, 10:51:04 am
You can change the number of lines shown under System: Settings: Logging for all log viewers. You can also reverse the display order.

Hi Franco, found this feature indeed. Suits my needs for now, so thread can be marked as solved.

Pagination has never been supported. It would make sense to add it, but not without starting to replace more of the logging code with MVC equivalents for future use.

Sounds like a (longer term) roadmap item then.... you want me to add a ticket for it, so it can be planned?
Title: Re: Browsing Log files for entries older than the last 50 lines
Post by: franco on March 18, 2019, 04:39:21 pm
Ticket only if there is workforce associated. I don't think the core team has capacity for this at the moment.


Cheers,
Franco