A CLI tool for Kafka

GitHub release Build Status Go Report Card Mentioned in Awesome Go

logo-small

Trubka is a Kafka CLI tool built in Go which gives you everything you need to

  • Manage, query and troubleshoot your Kafka clusters.
  • Consume protocol buffer and plain text messages from Kafka.
  • Publish protocol buffer and plain text messages to Kafka.

Documentation

Acknowledgments

Special thanks to Joshua Humphries for building the fascinating protoreflect package.

I would also like to mention some of the amazing libraries and packages I used for building Trubka:

Owner
Comments
  • [Feature]: Make

    [Feature]: Make "plain" list output plainer

    Plain text output is often very useful, and allows for output to be piped to standard unix tools for manipulation. However, the current "plain" output format has some decoration that impedes this, e.g.

    $ trubka list topics -f plain
    Topics (96)
    ───────────
     ● __consumer_offsets
     ● topic1
     ● topic2
     ● topic3
    [...]
    
     Total
    ─────
        Topics: 96
    Partitions: 180
    

    Please change plain, or add a different output format, that is just a simple plain-text list, with no decoration, headers, or footers, e.g.

    $ trubka list topics -f plain
    topic1
    topic2
    topic3
    
  • [Feature]: add JSON output format

    [Feature]: add JSON output format

    Consider adding JSON output format. For better or worse it's now the standard data interchange, and with tools like jq is easily manipulated, filtered, etc. This would be especially useful for creating input to tools like kafka-reassign-partitions.sh. For reference here's what that looks like, first for input to --topics-to-move-json-file:

    {
      "topics": [
        {
          "topic": "topic1" 
        },
        {
          "topic": "topic2" 
        },
        {
          "topic": "topic3" 
        }
      ],
      "version": 1
    }
    

    Then for input to --reassignment-json-file:

    {
      "version": 1,
      "partitions": [
        {
          "topic": "topic1",
          "partition": 0,
          "replicas": [1, 2],
          "log_dirs": ["any","any"]
        },
        {
          "topic": "topic2",
          "partition": 0,
          "replicas": [2, 3],
          "log_dirs": ["any","any"]
        },
        {
          "topic": "topic3",
          "partition": 0,
          "replicas": [1, 3],
          "log_dirs": ["any","any"]
        }
      ]
    }
    
  • [Feature]: Add a --to parameter to consumer

    [Feature]: Add a --to parameter to consumer

    Is your feature request related to a problem? Please describe. It would be nice to have a --to parameter in the consumer. One benefit is that you can pipe your consumed messages to a file and the consumer will finish once the --to condition is reached. Another benefit is that if you're searching through messages, it allows you to narrow your search.

    Describe the solution you'd like The ability to stop consuming by timestamp, by latest offset at the time of starting the consumer, and/or by specific offsets by partition.

    For example you could consume messages between 3pm and 4pm like:

    $ trubka consume plain <topic name> --brokers <broker:port> --from 22-02-2020T15:00:00 --to 22-02-2020T16:00:00

    Or you could consume messages from 3pm until now like:

    $ trubka consume plain <topic name> --brokers <broker:port> --from 22-02-2020T15:0:00 --to newest

  • [BUG]: Using TRUBKA_PROTO_ROOT does not work

    [BUG]: Using TRUBKA_PROTO_ROOT does not work

    Describe the bug Setting TRUBKA_PROTO_ROOT environment variable still gives an error about requiring the --proto-root flag.

    To Reproduce

    $ echo $TRUBKA_PROTO_ROOT
    /Users/jeff/dev/platypus
    
    $ trubka consume proto --topic-filter wifi --proto-filter Blip --brokers localhost:9092 --kafka-version 2.2.0 -i
    ERROR: Required flag --proto-root not provided
    

    Expected behavior If I provide this environment variable I shouldn't have to provide --proto-root. According to the wiki:

    It is possible to ask Trubka to read the cli flags from the system's environment variables. The flags must be in TRUBKA_FLAG_NAME format. For example the value of --proto-root parameter can be read from TRUBKA_PROTO_ROOT if it's provided.
    
  • Fix missing quote in boolean parsing regex

    Fix missing quote in boolean parsing regex

    I was trying to generate a boolean value, and I was getting an error, after checking the source code I could see what it was a bug. One missing quote is missing from the boolean regex, as a result the produced output still had the quote, producing an invalid JSON document

  • Add options to include topic metadata and offsets in list

    Add options to include topic metadata and offsets in list

    Today I needed to review the retentions configured for all our topics. Rather than iterating over all the topics with the shell I thought it might make sense to have the list command grab the metadata too. I added -c and -o options, same as describe, that causes it to grab the config and offsets and stick it into a Metadata field.

    Right now it only shows up in the json output, which probably makes sense, since the table would be unwieldy with all the metadata (but it would be really nice to be able to choose columns of interest).

    You may have some better idea or preference on how this is done, I'm open to ideas, but this met my need so I wanted to offer it back.

    Example usage:

    $ trubka list topics  -c -t ingest\.dcache\.billing -f json | \
    jq -c '.[] | {"name":.name, "retention_days":(.metadata.configurations | from_entries | ."retention.ms" | tonumber /1000/3600/24)}'
    {"name":"ingest.dcache.billing","retention_days":7}
    {"name":"ingest.dcache.billing.cms-disk","retention_days":7}
    {"name":"ingest.dcache.billing.cms-tape","retention_days":30}
    
  • [Feature]: Ability to format consumed proto bytes as a hex string

    [Feature]: Ability to format consumed proto bytes as a hex string

    Is your feature request related to a problem? Please describe. When using trubka consume proto if you have a protobuf with a field of type bytes, the field will be formatted as base64, but I would like to look at them in hex string format. There is an option to format your entire message as hex using -F hex but not just bytes fields.

    Describe the solution you'd like An option to output in -F json-indent format, but with individual fields of type bytes as hex strings. For example adding a flag --bytes-format [base64|hex]. You could take this concept even further and have custom formatting for any type with some kind of configuration file. For example you may want timestamps in a different format as well.

k6 extension to load test Apache Kafka with support for Avro messages and SASL Authentication

xk6-kafka This project is a k6 extension that can be used to load test Kafka, using a producer. Per each connection to Kafka, many messages can be sen

Dec 7, 2021
Covering basics of Go by writing practical running code. microservice-http server-DAO-Kafka

go1 Covering all basics of Go by writing practical running code. Prerequisite: basic knowledge of c programming language as go is very similar to c in

Mar 30, 2022
Nycmesh-tool - nycmesh-tool CLI

nycmesh-tool nycmesh-tool CLI Features At the moment, the tool is pretty sparse. It provides the top level nycmesh-tool command, with subcommands for:

Jun 17, 2022
Alertmanager-cli is a cli writtin in golang to silence alerts in AlertManager

Alertmanager-cli is a cli writtin in golang to silence alerts in AlertManager

Aug 27, 2022
ecsk is a CLI tool to interactively use frequently used functions of docker command in Amazon ECS. (docker run, exec, cp, logs, stop)
ecsk is a CLI tool to interactively use frequently used functions of docker command in Amazon ECS. (docker run, exec, cp, logs, stop)

English / 日本語 ecsk ECS + Task = ecsk ?? ecsk is a CLI tool to interactively use frequently used functions of docker command in Amazon ECS. (docker run

Dec 13, 2022
Cli tool to save useful links to read it later
Cli tool to save useful links to read it later

lnk - Cli tool to save useful links still in development Usage lnk <new|list> [url] - new: creates a new link url: required params, which i

Jun 23, 2022
Simple CLI tool and Kubernetes deployment.

Simple Application A basic example of how to build a naml project. app.go Every project should define an app.go file. The file should implement the De

Dec 21, 2022
tfa is a 2fa cli tool that aims to help you to generate 2fa code on CI/CD pipelines.

tfa tfa is 2fa cli tool that aim to help you to generate 2fa code on CI/CD pipelines. You can provide secret with stdin or flag. Install brew install

Nov 27, 2022
The CLI tool glueing Git, Docker, Helm and Kubernetes with any CI system to implement CI/CD and Giterminism
The CLI tool glueing Git, Docker, Helm and Kubernetes with any CI system to implement CI/CD and Giterminism

___ werf is an Open Source CLI tool written in Go, designed to simplify and speed up the delivery of applications. To use it, you need to describe the

Jan 4, 2023
The Coherence command line interface (CLI) is a lightweight tool, in the tradition of tools such as kubectl
The Coherence command line interface (CLI) is a lightweight tool, in the tradition of tools such as kubectl

Coherence Command Line Interface (CLI) Contents Overview Why use the Coherence C

Dec 15, 2022
CLI tool to setup Golang project.

go-setup CLI tool to setup Golang project. Installation Execute go install github.com/dark-shade/go-setup. Usage A CLI app that provides the ability t

Dec 29, 2021
Golang Cli Tool

step Easy Alias Management tool Arguments step {ALIAS} {COMMAND} init step init Store to create a new alias step store customer_1 -c "ssh user@IP

Oct 24, 2022
Gmail-cleanup - CLI tool for deleting attachments from gmail messages

gmail-cleanup CLI tool for deleting attachments from gmail messages Quickstart C

Jan 4, 2022
Use cli tool to troubleshoot external API service quickly.
Use cli tool to troubleshoot external API service quickly.

golang CLI Template golang project template for building CLI Setup Setup by Command git clone https://github.com/mpppk/cli-template your_awesome_tool

Jan 5, 2022
Operator Permissions Advisor is a CLI tool that will take a catalog image and statically parse it to determine what permissions an Operator will request of OLM during an install

Operator Permissions Advisor is a CLI tool that will take a catalog image and statically parse it to determine what permissions an Operator will request of OLM during an install. The permissions are aggregated from the following sources:

Apr 22, 2022
Terraform-equinix-migration-tool - Tool to migrate code from Equinix Metal terraform provider to Equinix terraform provider

Equinix Terraform Provider Migration Tool This tool targets a terraform working

Feb 15, 2022
Jenkins CLI allows you manage your Jenkins as an easy way

Quick start 简体中文 Jenkins CLI Jenkins CLI allows you manage your Jenkins in an easy way. No matter if you're a plugin developer, administrator or just

Jan 4, 2023
Fast, concurrent, streaming access to Amazon S3, including gof3r, a CLI. http://godoc.org/github.com/rlmcpherson/s3gof3r

s3gof3r s3gof3r provides fast, parallelized, pipelined streaming access to Amazon S3. It includes a command-line interface: gof3r. It is optimized for

Dec 26, 2022
Easily run your Compose application to the cloud with compose-cli

This CLI tool makes it easy to run Docker containers and Docker Compose applications in the cloud using either Amazon Elastic Container Service (ECS) or Microsoft Azure Container Instances (ACI) using the Docker commands you already know.

Jan 8, 2023