klogg icon indicating copy to clipboard operation
klogg copied to clipboard

[Feature Request] Counter for Events

Open Schrolli91 opened this issue 2 years ago • 6 comments

In an internal LogViewer of my Company we have a feature so called counter to count events inside the log files. This will be done by setting a Regex for UP-counting and one for DOWN-counting. image

In our case it will show the current value of the counter in front of every log entry. This makes it really easy to detect memory leaks for example (more allocs then frees). image

Maybe such an counter will be a useful tool for others.

Schrolli91 avatar Jun 28 '23 05:06 Schrolli91

I see this being useful in some cases. I am not sure what the UI for this feature in klogg should be. Klogg shows a count of matches, so doing two searches and subtracting the matches counts achieves the same result, but indeed in a more cumbersome manner.

variar avatar Jun 28 '23 07:06 variar

The idea in our tool is that I can see the count at any point in time.

For example, if our application is dynamically allocating and freeing buffers for received data, I can see the current number of allocated memory pools at any point in time (regex on recvBufferAlloc/recvBufferFree). This can also be quite useful to detect performance issues if the count increases over time.

This is not possible if only a "total difference" between two searches is shown.

Schrolli91 avatar Jun 28 '23 09:06 Schrolli91

Maybe such an function can be integrated via an "plugin"-interface or something?

Schrolli91 avatar Jun 30 '23 05:06 Schrolli91

Yes, this seems to be a good use case for plugins. There was a fork of klogg that implemented python plugins support. Not sure where it is now.

variar avatar Jul 01 '23 16:07 variar

Unfortunately i had no luck to find the fork.

Schrolli91 avatar Jul 12 '23 17:07 Schrolli91

Fork is here https://github.com/dkinsbur/klogg. However, it is quite outdated

variar avatar Jul 12 '23 17:07 variar