Q:

Extract lines from Kubernetes log

I'm new to kubernetes and am still trying to extract log from a few lines and write it, if anyone can help me what commands i should execute.
If the pod is named bino, and i wanted to extract the lines corresponding to the error unable-to-access-website, and then write them to a certain location, say John/Doe/bino. How would i do this is there a easy command?
I tried using kubectl log bino, but it just dumps all the output on the terminal, if i wanted to write certain parts how can i do it? Thanks!
Or if anyone has played around in katacoda i would appreciate a link to a similar example.

A:

You can use grep in linux to fetch the relevant log messages you want:
kubectl log bino | grep "error unable-to-access-website" >> John/Doe/Bino/log.txt

Hope this helps.

