Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Differentiate logs coming from different pods #11

Open
kenden opened this issue Sep 28, 2017 · 6 comments
Open

Differentiate logs coming from different pods #11

kenden opened this issue Sep 28, 2017 · 6 comments

Comments

@kenden
Copy link
Contributor

kenden commented Sep 28, 2017

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")
@boz
Copy link
Owner

boz commented Sep 28, 2017

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.

@kenden
Copy link
Contributor Author

kenden commented Sep 28, 2017

kubetail does it like this, by just getting the next color.

Stern uses https://github.com/fatih/color, here

@boz
Copy link
Owner

boz commented Sep 28, 2017

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.

@jmreicha
Copy link

Interested in a color option as well. FWIW I would never come close to tailing 250 pods.

@boz
Copy link
Owner

boz commented Apr 23, 2018

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.

@jglick
Copy link

jglick commented Sep 15, 2022

stern seems to do this out of the box (contra https://github.com/wercker/stern/issues/163).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants