glogg icon indicating copy to clipboard operation
glogg copied to clipboard

Feature Request: Loadable filter-files

Open gin-ahirsch opened this issue 6 years ago • 8 comments

I'd like to be able to export some of my filters to a file, copy that file on another computer and import the filters there.

I've been working on this feature myself. It's not quite ready for a PR as I need to test my changes some more, some functionality is missing and I'd like to split the commit into two or three separate ones.

Here's how the new FiltersDialog looks. First we have the "Loadable"-tab: FiltersDialog It displays the loaded files on the top. The filter sets are identified via their paths. I've thought about letting the user give a name to them which is displayed instead. The available filters in a file are displayed in the lower left and the activated filters in the lower right. When a loaded filter is subsequently modified, the changes can be undone or stored to the filter file (this is not yet implemented).

Then we have the "Active"-tab, which is mostly the original FiltersDialog: FiltersDialog The loaded filters are marked via an icon to the right. I'm not sure what the icon should be here, the circle is just something arbitrary to have something. Two things that are currently missing is a different icon when the filter has been modified here and I'd also like to show the filter-file a selected filter came from in a label below the controls in the right half. There's also the new "Save to file"-button. The ListWidget was changed to allow multiple items to be selected. A push of the button brings to a file-save-dialog to store the filters in a file on the disk, which can then be loaded in the "Loadable"-tab.

Apart from the unimplemented features already mentioned, the loaded files are currently also not saved on disk, i.e. they do not persist between two sessions. The current implementation can be tested from my filter-files branch. Feedback is welcome.

gin-ahirsch avatar Jul 19 '18 15:07 gin-ahirsch

While implementing the modification-detection I stumbled upon a couple of questions:

Should the view in "Loadable" be updated to include the modifications to the filter? Currently (not yet pushed) I just show the modification-symbol, but do not change the filter itself. There could also be a button to apply the new modifications to the file (and update the view accordingly), so that this is not immediate and automatic. The "Save changes"-button would be removed from the "Loadable"-tab. When saving filters to a file, should it automatically be added in the "Loadable"-tab, and should the filters be associated with it (so that further modification will show the modification-symbol)? Should saving a modified filter to a file remove the association with the original file it was loaded from?

I don't feel like there's a right answer here. Likely some decision just needs to be made. Another possibility would be disallowing modifications to a loaded filter and instead provide a "Copy"-button for the loaded filters instead, which will remove the association with the filter file. Though I think this is less nice if you indeed want to change (persistently) a filter from a file.

My favorite is the a button to manually update a modified filter, automatically add "Save to file" to the filter-files list and re-associating the saved filters with the new filter file.

gin-ahirsch avatar Jul 20 '18 12:07 gin-ahirsch

The branch is shaping up nicely.

Currently, modified version of loaded filters are only visible in the "Loadable" tab via a modification-icon. The item in the list is not changed to reflect the changes done.

The "Save changes" and "Undo changes" buttons work now.

The loaded filter files and local changes now also saved on disk and thus persist between sessions. Local changes are stored in the "glogg.conf" and do not change the loaded filter file (unless "Save changes" is used).

The loaded filter files are referred to from the "glogg.conf" via their absolute paths. It currently crashes via assert() if the file cannot be found, eventually I'd like to just put a red background on the item so that the "glogg.conf" can easily be moved between systems for example. Active filters from the filter files are also saved in "glogg.conf", so they can be active without the filter file being available.

Additionally, files matching "$AppLocalDataLocation/filters/*.conf" are automatically loaded.

gin-ahirsch avatar Aug 03 '18 08:08 gin-ahirsch

It would be really nice to have this. To have a file-based filtersystem would permit to have a different set of filters for different kind of logs! If I can add one, it would be great to have "filter-profiles" with a button toolbar where one could switch the profiles easily.

garyee avatar Jan 22 '19 07:01 garyee

@garyee Check out https://github.com/gin-ahirsch/glogg/tree/filter-files-for-upstream, I'm really just waiting on #230 or #236 to be merged before opening a PR. Note that these, and some other, changes are included in that branch (which is why a PR for it is not yet opened).

gin-ahirsch avatar Jan 22 '19 09:01 gin-ahirsch

I pushed two bug-fixes and changed the loaded- and modified-icons to resemble an "L" and an "M" respectively.

gin-ahirsch avatar Feb 08 '19 15:02 gin-ahirsch

Filter files are very crucial feature for log explorer. Hope this feature can be merged as soon as possible.

rickhau avatar Jul 06 '19 02:07 rickhau

This is a very important feature for our uses as well. This project is super useful - hands down the best open source log explorer currently available afaik.

amitkot avatar Aug 11 '19 14:08 amitkot

This has been implemented in klogg

variar avatar May 09 '21 21:05 variar