Skip to main content

CLI tool for querying Splunk logs. Search indexes, discover fields, and manage search jobs.

Project description

Splank

CLI tool for querying Splunk logs.

Install

uv tool install splank

Setup

splank init

This creates ~/.config/splank/credentials.toml with your Splunk credentials.

Configuration

The credentials file supports multiple profiles. Each profile authenticates either with a Splunk auth token (HTTP Authorization: Bearer …) or with username + password — set one or the other:

default_profile = "prod"

[profiles.prod]
host = "splunk.example.com"
port = 8089
token = "your-token-here"
verify_ssl = true

[profiles.qa]
host = "splunk-qa.example.com"
port = 8089
username = "admin"
password = "changeme"
verify_ssl = true

Usage

# Search (uses default profile)
splank search 'index=main Level=ERROR' -m 10

# Search using specific profile
splank -p qa search 'index=main Level=ERROR'

# Paste a Splunk web UI URL directly — query and time range are extracted
splank search 'https://splunk.example.com/en-US/app/search/search?q=search%20index%3Dmain&earliest=-30d%40d&latest=now'

# Discover indexes
splank discover 'web*'

# Discover with field info
splank discover 'app-*' --fields -o DISCOVERY.md

# Manage jobs
splank jobs
splank clear

Commands

  • init - Create credentials file
  • search - Execute SPL query
  • discover - Discover available indexes
  • jobs - List search jobs
  • clear - Clear my search jobs

Search Options

splank search 'index=main Level=ERROR' [options]
Option Description
-e, --earliest Earliest time (default: -24h)
-l, --latest Latest time (default: now)
-m, --max-results Max results (default: 100)
-f, --format Output format: json, csv, table, toon (default: toon)
-o, --output Output file (default: stdout)
--internal Include internal Splunk fields (_bkt, _cd, etc.)
-w, --width Truncate field values to N chars (default: 500, 0=no limit)
-z, --zoom Parse JSON from _raw and output as toon

By default, internal Splunk fields (_bkt, _cd, _indextime, _serial, _si, _sourcetype, _subsecond) are hidden. Use --internal to show them.

The --zoom flag is useful when log lines contain JSON - it extracts and parses the JSON from _raw, outputs as toon format (compact and human-readable), and ignores Splunk metadata.

Global Options

  • -p, --profile - Splunk profile to use (e.g., 'qa', 'prod')
  • -V, --version - Show version

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

splank-0.4.0.tar.gz (36.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

splank-0.4.0-py3-none-any.whl (45.0 kB view details)

Uploaded Python 3

File details

Details for the file splank-0.4.0.tar.gz.

File metadata

  • Download URL: splank-0.4.0.tar.gz
  • Upload date:
  • Size: 36.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for splank-0.4.0.tar.gz
Algorithm Hash digest
SHA256 d95f65cc78f8be3d5773c11f4dd0e827f0ccabcfaa3c2388cb620cf7feb5dca5
MD5 a112909529c9b9b2c51033b107ae84a8
BLAKE2b-256 f58e4a23077d3aaf143ddf02767d8031073c6c370712e787e65ae549c6a4b4e0

See more details on using hashes here.

File details

Details for the file splank-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: splank-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 45.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for splank-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 08de4318ef9ac5da013b7e38c40e1679b1f18f4f407b1b25a747144894634dd3
MD5 3433a156910d343df5b253102e55a5a1
BLAKE2b-256 18e835068625d24fe9ae73539f34fe2718399e533960ca8769ccb8f6363adf83

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page