2 releases

0.1.1 May 23, 2024
0.1.0 May 20, 2024

#61 in Debugging

Download history 308/week @ 2024-05-19 7/week @ 2024-05-26 5/week @ 2024-06-02

320 downloads per month

MIT license

40KB
834 lines

bul

ci

bul provides an interactive TUI to explore container logs for Kubernetes.

Features

  • Filter streaming container logs based on keywords
    • (currently) Not offer search functionality at the level of regular expressions, grep or fuzzy search
    • Extracts logs that match a specific word by contains
  • Digger mode
    • Enable querying the latest N logs when switching to the mode
  • Reconnect to log API
    • Allows users to control when to reconnect
  • Flow control that determines how many logs are rendered within a certain period

[!IMPORTANT] Please note that bul is still at a conceptual stage and in early development. Future updates may significantly alter its search capabilities and user interface.

Installation

Homebrew

brew install ynqa/tap/bul

Cargo

cargo install bul

Motivation

I frequently utilize kubectl logs or stern to analyze errors or debug applications by examining the logs of Kubernetes Pods.

For example:

kubectl logs -n my-namespace my-pod | grep "something"
# Or
stern pod-query | grep "something"

Typically, when analyzing logs, these commands are used in conjunction with grep to filter for specific keywords. However, this process requires repeatedly running the command with adjusted parameters, and re-running the command each time can be cumbersome.

To address this issue, bul project provides to allow users to filter and review logs in real-time. This design enables dynamic adjustment of filtering criteria without the need to rerun the command.

Keymap

Key Action
Ctrl + C Exit bul
Ctrl + F Enter digger mode
Ctrl + R Reconnect to log API
Move the cursor one character to the left
Move the cursor one character to the right
Ctrl + A Move the cursor to the start of the filter
Ctrl + E Move the cursor to the end of the filter
Backspace Delete a character of filter at the cursor position
Ctrl + U Delete all characters of filter

Usage

Interactive Kubernetes log viewer

Usage: bul [OPTIONS]

Options:
      --context <CONTEXT>
          Kubernetes context.
  -n, --namespace <NAMESPACE>
          Kubernetes namespace.
  -p, --pod-query <POD_QUERY>
          query to filter Pods.
      --container-states <CONTAINER_STATUS>
          Container states to filter containers. [default: all] [possible values: all, running, terminated, waiting]
      --log-retrieval-timeout <LOG_RETRIEVAL_TIMEOUT_MILLIS>
          Timeout to read a next line from the log stream in milliseconds. [default: 100]
      --render-interval <RENDER_INTERVAL_MILLIS>
          Interval to render a log line in milliseconds. [default: 10]
  -q, --queue-capacity <QUEUE_CAPACITY>
          Queue capacity to store the logs. [default: 1000]
  -h, --help
          Print help (see more with '--help')

Dependencies

~64MB
~1M SLoC