Hello, please ask 2 questions.
I want to develop a command line tool based on loki’s http api and logql, and want to achieve the following functions:
- Search for the error keyword and its context, similar to the linux command ‘grep -C 10 error a.log’ . I know that logql has log line filter and http range query, but I don’t know how to find the 10 lines before and after it.
- Search for the error keyword and support jump search. For example, after searching for the first error keyword, press the n key to jump to the next matching error keyword, and search for the 10 lines before and after the next error.like linux less command.
Thank you for your guidance