Differentiate logs coming from different pods
kenden opened this issue · 6 comments
It would be nice to differentiate the logs coming from different pods.
Show all pods with a different color?
Or maybe, depending on params, something like this:
If logs are shown from different pods, it could be nice to show different colors.
$ kail
---> show all pods in the same namespace with the same colors? Else, different colors?
$ kail --ns kube-system
---> show pods bellonging to the same deployment/daemonset/rs/rc with the same color, and different colors otherwise?
$ kail --ns kube-system --ds <name>
$ kail --ns kube-system --deploy <name>
$ kail --ns kube-system --rs <name>
$ kail --ns kube-system --rc <name>
$ kail --ns kube-system --ing <name>
---> show all pods with a different color?
Here is what I miss:
kubetail --help
:
-k, --colored-output Use colored output (pod|line|false).
pod = only color podname, line = color entire line, false = don't use any colors.
Defaults to line.
stern --help
:
--color string Color output. Can be 'always', 'never', or 'auto' (default "auto")
I've looked into it a bit. I'm concerned about how easy it is to exhaust all discernibly different colors. After going down a "truecolor" rabbit hole, I put it on the back burner for a while.
Really interesting ideas for reducing the number of colors used. They may make it feasible, but will take a fair amount of code changes.
How does kubetail and stern handle this?
Thanks for the feedback, I'll start thinking this again.
kubetail does it like this, by just getting the next color.
Stern uses https://github.com/fatih/color, here
yeah, so stern cycles through six color schemes and kubetail uses ~254 of them and then the behavior seems undefined.
I'm not really satisfied with either approach.
Maybe ~250 colors is enough. Maybe it partitions it by namespace and container (they each use different pools of colors). Whatever happens I think that when pods die they need to relinquish the color that they're using, and something reasonable should happen when there's no more colors available.
An additional problem is that $TERM
is not passed through when using docker/kubectl. It's really annoying.
edit: by using background and foreground we can stretch the pallet usage out quite a bit too.
Interested in a color option as well. FWIW I would never come close to tailing 250 pods.
Thanks for your feedback @jmreicha. Maybe a --no-color
or similar switch would be good enough for the large pod count use-cases. I personally don't typically use it with >250 pods.
I'll look at this again when I have some time and/or need a change of pace.
stern
seems to do this out of the box (contra https://github.com/wercker/stern/issues/163).