ansible-for-kubernetes
ansible-for-kubernetes copied to clipboard
differentiate log lines by pod name
version 2020-09-01 Chap 1 page 16 info point says "Currently, kubectl logs doesn’t differentiate log lines by pod name" it seems it is not the case anymore with --prefix=true doc says : --prefix=false: Prefix each log line with the log source (pod name and container name)
ex: kubectl logs -l app=echo-req --prefix=true [pod/echo-req-7cfd7bf68f-nk5kr/hello] 172.17.0.1 - - [22/Nov/2020:17:19:05 +0000] "GET /test HTTP/1.1" 200 7269 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:83.0) Gecko/20100101 Firefox/83.0" "-" [pod/echo-req-7cfd7bf68f-dhrwd/hello] 172.17.0.1 - - [22/Nov/2020:17:22:01 +0000] "GET /anothertest HTTP/1.1" 200 7252 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:83.0) Gecko/20100101 Firefox/83.0" "-"
Ooh, nice! I wonder when that was added in. I know I wrote that line at least one or two years ago, and originally it couldn't show which pod the logs were from AFAICR.
found this in v1.17 release note CLI Improvements A new --prefix flag added into kubectl logs which prepends each log line with information about it’s source (pod name and container name) (#76471, @m1kola