Skip to content
This repository has been archived by the owner on Aug 18, 2024. It is now read-only.

tdakkota-legacy/docker-logql

Repository files navigation

docker-logql

A simple Docker CLI plugin to run LogQL queries over docker container logs.

Installation

  1. Build docker-logql binary.
    • NOTE: docker- prefix is important, docker would not find plugin without it.
  2. Add binary to plugin directory
    • ~/.docker/cli-plugins for current user
    • /usr/local/libexec/docker/cli-plugins for system-wide installation

Or use make install, it would build and add plugin to ~/.docker/cli-plugins directory.

git clone https://github.com/tdakkota/docker-logql
cd docker-logql
make install

Query logs

$ docker logql query --help

Usage:  docker logql query <logql>

Examples:
# Get logs from all containers.
docker logql query '{}'

# Get logs for last 24h from container "registry" that contains "info".
docker logql query --since=1d '{container="registry"} |= "info"'

Options:
      --color                             Enable color (default true)
  -c, --container                         Show container name (default true)
      --end lokiapi.LokiTime              End of query range
      --limit int                         Limit result (default -1)
      --since start                       A duration used to calculate start relative to `end`
      --start lokiapi.LokiTime            Start of query range
      --step lokiapi.PrometheusDuration   Query resolution step
  -t, --timestamp                         Show timestamps (default true)