2022-05-15

grep for a pattern "variable=value" and returning only matching entries having a value > threshold

I am searching a kubernetes pod logs for the pattern “variable=value” ( e.g., variable=10 or variable=500) using the command below:

Kubectl logs -f | grep “variable=”

My question is that wether it is possible to modify the command above in order to return the logs where the variable value is greater than some threshold, e.g, for threshold=300, variable=301, variable=302 would be filetered in, but variable=299 would be filtered out

I know I can develop a small program for this, but rather I want a rapid solution in the command line direcly without the hassle of writing a small prgram.



No comments:

Post a Comment