kubetail-org / kubetail

Web-based, real-time log viewer for Kubernetes
https://www.kubetail.com/demo
Apache License 2.0
301 stars 16 forks source link

Support for search / highlight #13

Open alexcherka opened 4 months ago

alexcherka commented 4 months ago

Would be really nice if you could filter console lines via search. Or even just highlight a desired key. I know this may not be the intention of this tool but when filtering back in time, would be great to search for specific data if needed!

amorey commented 4 months ago

Thanks for the suggestion! I definitely want to add search/highlight functionality to kubetail. It will take some time to implement but now's a good time to start specing it out. Is there another tool that you think has implemented log search particularly well so far?

alexcherka commented 4 months ago

As far as web k8s logs viewers go, I don't think there is much out there honestly... I know for IDE's I use K8s Lens that when you view a pod's logs it allows for searching via highlight and then jump around to results. image

I think this is the best option depending on how you render your front end results. I assume there is some JS packages that allow for search/highlight content on page.

Found something that seems to cover it pretty well. https://markjs.io/ Specifically the example Search bar with jump to matches image

amorey commented 4 months ago

Thanks! I'll take a look at K8S Lens and mark.js.

nodesocket commented 4 months ago

Are you thinking client side search? DataDog Logs (paid solution) does a really good job at filtering and searching.

amorey commented 4 months ago

I'm curious about doing search client side but I have a feeling that performance will be an issue. I think I'll do some experiments with IndexedDB to see if it's feasible.

nefarius commented 4 months ago

I think in this case client-side search and indexing makes sense; no load increase on the backend and the client already has all the searchable data anyway so why not make use of it.

alexcherka commented 4 months ago

I agree with @nefarius, The front end data is loaded in the first place regardless and then filtering can be done client/DOM level and in theory no extra heavy lifting on the backend or really front end either. I think a highlighting approach is best and just have it jump around to matches. Similar to vscode in file search or any other ide as an example

amorey commented 4 months ago

Currently, the frontend only stores new events so the full log files aren't directly accessible locally. We could change this behavior and download the full files in the background and that would work well for small/medium files but it could be problematic for large amounts of data (and egress costs could also be an issue down the road for power users). I'm still curious to test out client side search though because it might be useful for small amounts of data or in other contexts.