{"id":13471569,"url":"https://github.com/cswank/kcli","last_synced_at":"2026-04-10T00:02:36.427Z","repository":{"id":57497065,"uuid":"86187150","full_name":"cswank/kcli","owner":"cswank","description":"A kafka command line browser","archived":false,"fork":false,"pushed_at":"2020-01-04T00:26:19.000Z","size":69294,"stargazers_count":216,"open_issues_count":1,"forks_count":18,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-10-30T02:59:46.562Z","etag":null,"topics":["browser","cli","kafka"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cswank.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-25T20:41:22.000Z","updated_at":"2024-09-29T09:41:23.000Z","dependencies_parsed_at":"2022-09-03T02:00:13.304Z","dependency_job_id":null,"html_url":"https://github.com/cswank/kcli","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cswank%2Fkcli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cswank%2Fkcli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cswank%2Fkcli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cswank%2Fkcli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cswank","download_url":"https://codeload.github.com/cswank/kcli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245662845,"owners_count":20652095,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["browser","cli","kafka"],"created_at":"2024-07-31T16:00:46.790Z","updated_at":"2025-12-16T01:02:12.338Z","avatar_url":"https://github.com/cswank.png","language":"Go","readme":"# kcli\nKcli is a kafka read only command line browser.\n\n\u003cimg src=\"./docs/kcli.gif\"/\u003e\n\n## Install\n\nBinaries are provided [here](https://github.com/cswank/kcli/releases/tag/1.4.1) (windows\nis not tested).  If you have go (1.11 or greater) installed you can do:\n\n```console\n$ go get -u github.com/cswank/kcli\n```\n\n## Usage\n\n```console\nkcli --help\nusage: kcli [\u003cflags\u003e]\n\nFlags:\n      --help             Show context-sensitive help (also try --help-long and --help-man).\n  -a, --addresses=localhost:9092 ...\n                         comma separated list of kafka addresses\n  -l, --log=LOG          for debugging, set the log output to a file\n  -t, --topic=TOPIC      go directly to a topic\n  -p, --partition=-1     go directly to a partition of a topic\n  -o, --offset=-1        go directly to a message\n  -d, --decoder=DECODER  path to a plugin to decode kafka messages\n```\n\nNOTE: If your Kafka cluster has tls authentication enabled you need to set the\nfollowing env vars:\n\n```console\nexport KCLI_CERT_FILE=\"\u003cpath to a client cert file in pem format\u003e\"\nexport KCLI_KEY_FILE=\"\u003cpath to a client key file in pem format\u003e\"\nexport KCLI_CA_CERT_FILE=\"\u003cpath to a ca cert file in pem format\u003e\"\n```\n\nAfter starting it up you get a list of topics:\n\n\u003cimg src=\"./docs/one.png\"/\u003e\n\nType 'h' to see the help menu (type 'h' again to toggle the help menu off):\n\n\u003cimg src=\"./docs/two.png\"/\u003e\n\nNavigate to a topic and hit enter to see the partitions:\n\n\u003cimg src=\"./docs/three.png\"/\u003e\n\nNavigate to a partition and hit enter to see a page of messages:\n\n\u003cimg src=\"./docs/four.png\"/\u003e\n\nAnd navigate to a message and hit enter to see the message:\n\n\u003cimg src=\"./docs/five.png\"/\u003e\n\n### Searching\nYou can search for a string on either a partition or topic.  When you search\non a partition then the current offset is set to the first message that\ncontains the search string.  When you search on a topic then only the topics\nthat contain a match are printed to the screen and their current offset is\nset to the first message that contains that match.\n\nIf you have partitions that have large amounts of data then it can take a\nlong time to search through all the partitions.  It is sometimes useful\nto use the partition offset functionality (C-o) to speed up your\nsearch if you have an idea where the message might be.  If you know the message\nyou are searching for is fairly recent then you can use a negative offset to set\nthe offset of each partition close to then last end.  The search will then start\nfrom those offsets.\n\n### Jumping\nYou can use the jump command (C-j) to set the current offset of a partition.\nJumping on a partition is simple: the number you enter becomes the current offset.\nOn other views (topic and message views) jump navigates the cursor to the value\nyou enter.\n\n### Printing\nIf you enter C-p kcli will exit and the contents of the current view will be printed to\nstdout.  If the current view is a partition then each message from the cursor to the end\nof the partition is printed to stdout.  This is useful if you want to process the messages,\nfor example:\n\n```console\nkcli | jq .age | awk '{s+=$1} END {print s}'\n```\n\nAssuming the messages that get printed are JSON, this print the sum of all age fields\nfrom each message in the partition.\n\n### Custom Decoder\nIf your kafka messages are encoded in some way you can provide a custom decoder\nin the form of a plugin.  See [.examples/plugins/protobuf](./examples/plugins/protobuf/main.go)\nfor an example.  Once you have compiled the plugin you use it as the default decoder\nby starting kcli like so:\n\n```console\nkcli -d /path/to/your/decoder.so\n```\n\n### Screen Colors\n\nIf you don't like the defaul colors you can set KCLI_COLOR[0,1,2,3] to one of:\n\n* black\n* red\n* green\n* yellow\n* blue\n* magenta\n* cyan\n* white\n\nFor example:\n\n    $ KCLI_COLOR0=white KCLI_COLOR1=blue KCLI_COLOR2=black KCLI_COLOR3=red\n\n\u003cimg src=\"./docs/six.png\"/\u003e\n\nSee it in action at [asciinema](https://asciinema.org/a/wTeIxxlIhgQzSQv9mIAG689sP)\n\n[![asciicast](https://asciinema.org/a/wTeIxxlIhgQzSQv9mIAG689sP.png)](https://asciinema.org/a/wTeIxxlIhgQzSQv9mIAG689sP)\n\nNOTE: If you are connecting to a local kafka that is running in a docker container\nusing wurstmeister/kafka you may have the env KAFKA_ADVERTISED_HOST_NAME set to\na name that is used by other containers that need to connect to kafka.  This will\ncause kcli to not be able to read from kafka.  A hacky fix is to edit your /etc/hosts\nfile and add another name to the 127.0.0.1 network interface.  For example, if\n\n    KAFKA_ADVERTISED_HOST_NAME=kafka\n\nThen the 127.0.0.1 line /etc/hosts should look like:\n\n    127.0.0.1       localhost kafka\n","funding_links":[],"categories":["Go","Software Packages","DevOps Tools","软件包","Go Tools","Go 工具","CLI Tools"],"sub_categories":["DevOps Tools","DevOps 工具","代码分析","DevOps工具","Interactive Tools","devops 工具"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcswank%2Fkcli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcswank%2Fkcli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcswank%2Fkcli/lists"}