k9s icon indicating copy to clipboard operation
k9s copied to clipboard

Feature: Filter shortcuts in logs

Open hami-sh opened this issue 5 months ago • 0 comments

This PR enables a set of shortcuts to be used when filtering through logs in k9s.

A new config file filters.yaml is defined, an example of which is shown below:

 filters:
   http_errors: '"status_code":[4-5]\d{2}'
   http_success: '"status_code":[2]\d{2}'
   info: 'info'

When using the / keybind in the logs view for a pod, a user can type the @ key followed by the name of the filter to access the pre-written regex or string they wish to match on. An example from the above would be @http_errors -- note how the title automatically resolves to the regex that was applied by the filter:

image

This is especially helpful when using complex regexes that a user might want to have close at hand when searching through logs.

hami-sh avatar Sep 05 '24 09:09 hami-sh