GithubHelp home page GithubHelp logo

andjelx / kubetail Goto Github PK

View Code? Open in Web Editor NEW

This project forked from johanhaleby/kubetail

0.0 2.0 0.0 79 KB

Bash script to tail Kubernetes logs from multiple pods at the same time

License: Apache License 2.0

Shell 100.00%

kubetail's Introduction

Kubetail

Bash script that enables you to aggregate (tail/follow) logs from multiple pods into one stream. This is the same as running "kubectl logs -f " but for multiple pods.

Installation

Just download the kubetail file (or any of the releases) and you're good to go.

Homebrew

You can also install kubetail using brew:

$ brew tap johanhaleby/kubetail && brew install kubetail

Use brew install --HEAD kubetail to install the latest (unreleased) version.

Usage

First find the names of all your pods:

$ kubectl get pods

This will return a list looking something like this:

NAME                   READY     STATUS    RESTARTS   AGE
app1-v1-aba8y          1/1       Running   0          1d
app1-v1-gc4st          1/1       Running   0          1d
app1-v1-m8acl  	       1/1       Running   0          6d
app1-v1-s20d0  	       1/1       Running   0          1d
app2-v31-9pbpn         1/1       Running   0          1d
app2-v31-q74wg         1/1       Running   0          1d
my-demo-v5-0fa8o       1/1       Running   0          3h
my-demo-v5-yhren       1/1       Running   0          2h

To tail the logs of the two "app2" pods in one go simply do:

$ kubetail app2

To tail only a specific container from multiple pods specify the container like this:

$ kubetail app2 -c container1

You can repeat -c to tail multiple specific containers:

$ kubetail app2 -c container1 -c container2

Supply -h for help and additional options:

$ kubetail -h

Colors

By using the -k argument you can specify how kubetail makes use of colors (only applicable when tailing multiple pods).

Value Description
pod Only the pod name is colorized but the logged text is using the terminal default color
line The entire line is colorized (default)
false Don't colorize the output at all

Example:

$ kubetail app2 -k false

Filtering / Highlighting etc

kubetail itself doesn't have filtering or highlighting capabilities built-in. If you're on MacOSX I recommend using iTerm2 which allows for continuous highlighting of search terms, good scrolling capabilities and multitab arrangements. Another useful feature of iTerm2 is the "timeline" (cmd + shift + e) which lets you display a timeline in your own local timezone next to the logs (that are typically in UTC).

If you're not using iTerm2 or think that kubetail is lacking in features there's a fork of kubetail made by Alan Stebbens that allows for richer configuration and uses multitail and bash-lib. Alan has been kind enough to provide a pull request but my current thinking is that I'd like kubetail to stay simple and small and not use any dependencies.

More

Pull requests are very welcome!

See also: http://code.haleby.se/2015/11/13/tail-logs-from-multiple-pods-simultaneously-in-kubernetes/

kubetail's People

Contributors

aaronzirbes avatar andjelx avatar astorije avatar bean5 avatar ben-harack avatar dariusf avatar dimasalakhov avatar esvinson avatar felixbuenemann avatar fmmr avatar franciscocpg avatar johanhaleby avatar mando avatar nsilve avatar pigri avatar samirtalwar avatar sgrimee avatar vitorenesduarte avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.