Skip to main content

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.

To add a single profile without opening an editor, pass a name (and optionally a host) instead:

splank init qa mystack   # bare stack names expand to <name>.splunkcloud.com
splank init qa splunk-qa.example.com

This runs a short wizard (token only — it prompts just for the token), tests the connection before saving, and appends the profile to your existing credentials file (creating it if needed). It offers to overwrite if the name already exists, and to set the new profile as default_profile.

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, or init <name> [host] to add one profile via a short token-only wizard
  • 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

Release files for splank 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for splank 0.5.0
File Size Uploaded
splank-0.5.0.tar.gz 38.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for splank 0.5.0
File Interpreter ABI Platform
splank-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 85.6 kB

Release files / splank-0.5.0.tar.gz

Download URL splank-0.5.0.tar.gz
Size 38.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a01198e2dc9a1184247c4600d2e380f7eb0850c5e47b30f91b7a75ae0794bb89
BLAKE2b-256 checksum
How to use checksums
fbbb55393e42202deb23156f89f6e72ab8e1e5b7ed0dd4a016a6bc9156644ffd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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}

Release files / splank-0.5.0-py3-none-any.whl

Download URL splank-0.5.0-py3-none-any.whl
Size 46.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
97474035d24fb2489de9908d42d5bb3a4bde885c52afd174831728464a50ded9
BLAKE2b-256 checksum
How to use checksums
6549b1d6018015b3aae7d2635568f95d6b9c83dc63031e85d1019af4bd5eb43b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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}

Release history Release notifications | RSS feed

0.5.1

2 release files

This release

0.5.0 This release

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page