AdGuardHome icon indicating copy to clipboard operation
AdGuardHome copied to clipboard

QueryLog Interface

Open elee1766 opened this issue 3 years ago • 0 comments

I have been looking for a while to reduce the footprint of the logs on my machine, while still keeping them.

this pr is the start of that work, and does the following:

  1. splits querylog package into two, "logs", and "jsonfile". jsonfile contains things specifically related to the existing on-disk format, while logs includes http handler, interfaces, and shared structs for a "logs.Api implementation" to use.
  2. changes the HTTP to use a properly tagged struct with omitempty tags which then marshals to json, instead of populating a map.
  3. Extends the "Store" interface to include methods "ApplyConfig", "ConfigInfo", and "Clear", interface "Searcher" which uses struct "SearchParams" to get result "LogsPayload", and interface "Api", a Search + Store.

my idea is that one could implement the "Store" and "Searcher" interfaces for different sorts of storage and indexing backends.

This would allow people to create their own log storage & search implementations. looking at #2290, it seems that people are eager to have custom log sinks, but the existing implementation makes it hard to add a new one.

I think more thought needs to be put into an actual interface, along with the configuration format, but I do not feel like the qualified person to do that. so my goal in this PR was mostly to keep compatibility with the existing logging implementation, keeping the changes simple. hopefully we can move from here to something better. that said, things have to start somewhere, so I thought I would make the PR anyways.

new to this project, so if i did anything wrong, please let me know. happy to make any changes / take any suggestions

elee1766 avatar Nov 04 '22 12:11 elee1766