splunk-cli 0.0.2__tar.gz → 0.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- splunk_cli-0.0.3/.dockerignore +9 -0
- splunk_cli-0.0.3/CHANGELOG.md +42 -0
- {splunk_cli-0.0.2 → splunk_cli-0.0.3}/Cargo.lock +62 -1
- {splunk_cli-0.0.2 → splunk_cli-0.0.3}/Cargo.toml +7 -2
- {splunk_cli-0.0.2 → splunk_cli-0.0.3}/Makefile +5 -1
- {splunk_cli-0.0.2 → splunk_cli-0.0.3}/PKG-INFO +123 -21
- {splunk_cli-0.0.2 → splunk_cli-0.0.3}/README.md +122 -20
- splunk_cli-0.0.3/scripts/test-live.sh +58 -0
- splunk_cli-0.0.3/src/auth.rs +1044 -0
- splunk_cli-0.0.3/src/browser.rs +2235 -0
- {splunk_cli-0.0.2 → splunk_cli-0.0.3}/src/cli.rs +123 -19
- {splunk_cli-0.0.2 → splunk_cli-0.0.3}/src/client.rs +80 -12
- splunk_cli-0.0.3/src/config.rs +430 -0
- {splunk_cli-0.0.2 → splunk_cli-0.0.3}/src/error.rs +6 -0
- splunk_cli-0.0.3/src/interrupt.rs +17 -0
- {splunk_cli-0.0.2 → splunk_cli-0.0.3}/src/lib.rs +2 -0
- splunk_cli-0.0.3/src/main.rs +115 -0
- splunk_cli-0.0.3/src/output.rs +511 -0
- {splunk_cli-0.0.2 → splunk_cli-0.0.3}/src/schema.rs +69 -13
- splunk_cli-0.0.3/src/workflows.rs +678 -0
- splunk_cli-0.0.3/tests/cli.rs +1740 -0
- splunk_cli-0.0.3/tests/live/Dockerfile +15 -0
- splunk_cli-0.0.3/tests/live/README.md +54 -0
- splunk_cli-0.0.3/tests/live/check.py +419 -0
- splunk_cli-0.0.3/tests/live/entrypoint.sh +11 -0
- splunk_cli-0.0.2/CHANGELOG.md +0 -23
- splunk_cli-0.0.2/src/auth.rs +0 -566
- splunk_cli-0.0.2/src/config.rs +0 -204
- splunk_cli-0.0.2/src/main.rs +0 -82
- splunk_cli-0.0.2/src/output.rs +0 -111
- splunk_cli-0.0.2/src/workflows.rs +0 -368
- splunk_cli-0.0.2/tests/cli.rs +0 -676
- {splunk_cli-0.0.2 → splunk_cli-0.0.3}/.github/workflows/ci.yml +0 -0
- {splunk_cli-0.0.2 → splunk_cli-0.0.3}/.github/workflows/release.yml +0 -0
- {splunk_cli-0.0.2 → splunk_cli-0.0.3}/.gitignore +0 -0
- {splunk_cli-0.0.2 → splunk_cli-0.0.3}/LICENSE +0 -0
- {splunk_cli-0.0.2 → splunk_cli-0.0.3}/docs/releases.md +0 -0
- {splunk_cli-0.0.2 → splunk_cli-0.0.3}/prek.toml +0 -0
- {splunk_cli-0.0.2 → splunk_cli-0.0.3}/pyproject.toml +0 -0
- {splunk_cli-0.0.2 → splunk_cli-0.0.3}/schemas/clispec-v0.3.json +0 -0
- {splunk_cli-0.0.2 → splunk_cli-0.0.3}/scripts/score-clispec.py +0 -0
- {splunk_cli-0.0.2 → splunk_cli-0.0.3}/tests/conformance.rs +0 -0
- {splunk_cli-0.0.2 → splunk_cli-0.0.3}/vership.toml +0 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.0.3](https://github.com/rvben/splunk-cli/compare/v0.0.2...v0.0.3) - 2026-11-04
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Guided `init`, read-only `doctor`, and offline credential diagnostics.
|
|
14
|
+
- Persistent profile selection with `profile list`, `use`, and guarded `remove`.
|
|
15
|
+
- Aligned terminal tables, CSV and JSONL exports, and SPL files or piped stdin.
|
|
16
|
+
- Bounded `jobs wait` / `watch` and multi-page `jobs export` of an existing job.
|
|
17
|
+
- **auth**: add browser SSO login and opt-in file credential store ([0b31305](https://github.com/rvben/splunk-cli/commit/0b313053fc510696b90704c40c6ba825bdec6dff))
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- Surface sanitized, credential-redacted Splunk warnings even with `--quiet`.
|
|
22
|
+
- Exit quietly when a pipeline consumer closes stdout.
|
|
23
|
+
- Redact encoded Basic credentials in API diagnostics and explain permission failures.
|
|
24
|
+
- Preserve config symlinks, improve CA and usage errors, and handle interrupted output.
|
|
25
|
+
- Correct interactive-login documentation and expand command examples.
|
|
26
|
+
- Keep saved-login diagnostics and profile removal consistent across keyring and file stores.
|
|
27
|
+
|
|
28
|
+
## [0.0.2](https://github.com/rvben/splunk-cli/compare/v0.0.1...v0.0.2) - 2026-11-03
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
|
|
32
|
+
- **auth**: add interactive login with OS credential storage ([3c03442](https://github.com/rvben/splunk-cli/commit/3c03442c1430e39bb94e4c6f9e97113c99a50f34))
|
|
33
|
+
|
|
34
|
+
## [0.0.1] - 2026-11-03
|
|
35
|
+
|
|
36
|
+
### Added
|
|
37
|
+
|
|
38
|
+
- add clispec-compliant Splunk CLI and PyPI packaging
|
|
39
|
+
|
|
40
|
+
### Fixed
|
|
41
|
+
|
|
42
|
+
- **ci**: install the v0.3 scorer from pinned source ([dc3d4ff](https://github.com/rvben/splunk-cli/commit/dc3d4ff2c42a27a0d0f3f4f9280203832805d717))
|
|
@@ -2277,6 +2277,17 @@ dependencies = [
|
|
|
2277
2277
|
"serde",
|
|
2278
2278
|
]
|
|
2279
2279
|
|
|
2280
|
+
[[package]]
|
|
2281
|
+
name = "sha1"
|
|
2282
|
+
version = "0.11.0"
|
|
2283
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2284
|
+
checksum = "aacc4cc499359472b4abe1bf11d0b12e688af9a805fa5e3016f9a386dc2d0214"
|
|
2285
|
+
dependencies = [
|
|
2286
|
+
"cfg-if",
|
|
2287
|
+
"cpufeatures 0.3.1",
|
|
2288
|
+
"digest 0.11.3",
|
|
2289
|
+
]
|
|
2290
|
+
|
|
2280
2291
|
[[package]]
|
|
2281
2292
|
name = "sha2"
|
|
2282
2293
|
version = "0.10.9"
|
|
@@ -2355,11 +2366,13 @@ dependencies = [
|
|
|
2355
2366
|
|
|
2356
2367
|
[[package]]
|
|
2357
2368
|
name = "splunk-cli"
|
|
2358
|
-
version = "0.0.
|
|
2369
|
+
version = "0.0.3"
|
|
2359
2370
|
dependencies = [
|
|
2371
|
+
"base64 0.23.1",
|
|
2360
2372
|
"clap",
|
|
2361
2373
|
"clap_complete",
|
|
2362
2374
|
"dirs",
|
|
2375
|
+
"futures-util",
|
|
2363
2376
|
"jsonschema",
|
|
2364
2377
|
"keyring",
|
|
2365
2378
|
"reqwest",
|
|
@@ -2368,8 +2381,11 @@ dependencies = [
|
|
|
2368
2381
|
"serde_json",
|
|
2369
2382
|
"sha2 0.10.9",
|
|
2370
2383
|
"tempfile",
|
|
2384
|
+
"terminal_size",
|
|
2371
2385
|
"tokio",
|
|
2386
|
+
"tokio-tungstenite",
|
|
2372
2387
|
"toml",
|
|
2388
|
+
"unicode-width",
|
|
2373
2389
|
"wiremock",
|
|
2374
2390
|
]
|
|
2375
2391
|
|
|
@@ -2446,6 +2462,16 @@ dependencies = [
|
|
|
2446
2462
|
"windows-sys 0.61.2",
|
|
2447
2463
|
]
|
|
2448
2464
|
|
|
2465
|
+
[[package]]
|
|
2466
|
+
name = "terminal_size"
|
|
2467
|
+
version = "0.4.4"
|
|
2468
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2469
|
+
checksum = "230a1b821ccbd75b185820a1f1ff7b14d21da1e442e22c0863ea5f08771a8874"
|
|
2470
|
+
dependencies = [
|
|
2471
|
+
"rustix",
|
|
2472
|
+
"windows-sys 0.61.2",
|
|
2473
|
+
]
|
|
2474
|
+
|
|
2449
2475
|
[[package]]
|
|
2450
2476
|
name = "thiserror"
|
|
2451
2477
|
version = "2.0.21"
|
|
@@ -2492,6 +2518,7 @@ dependencies = [
|
|
|
2492
2518
|
"libc",
|
|
2493
2519
|
"mio",
|
|
2494
2520
|
"pin-project-lite",
|
|
2521
|
+
"signal-hook-registry",
|
|
2495
2522
|
"socket2",
|
|
2496
2523
|
"tokio-macros",
|
|
2497
2524
|
"windows-sys 0.61.2",
|
|
@@ -2518,6 +2545,18 @@ dependencies = [
|
|
|
2518
2545
|
"tokio",
|
|
2519
2546
|
]
|
|
2520
2547
|
|
|
2548
|
+
[[package]]
|
|
2549
|
+
name = "tokio-tungstenite"
|
|
2550
|
+
version = "0.30.0"
|
|
2551
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2552
|
+
checksum = "17a073bfed563fa236697a068031408a93cd9522e08abf9933ead3e73411bd71"
|
|
2553
|
+
dependencies = [
|
|
2554
|
+
"futures-util",
|
|
2555
|
+
"log",
|
|
2556
|
+
"tokio",
|
|
2557
|
+
"tungstenite",
|
|
2558
|
+
]
|
|
2559
|
+
|
|
2521
2560
|
[[package]]
|
|
2522
2561
|
name = "tokio-util"
|
|
2523
2562
|
version = "0.7.20"
|
|
@@ -2665,6 +2704,22 @@ version = "0.2.5"
|
|
|
2665
2704
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2666
2705
|
checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
|
|
2667
2706
|
|
|
2707
|
+
[[package]]
|
|
2708
|
+
name = "tungstenite"
|
|
2709
|
+
version = "0.30.0"
|
|
2710
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2711
|
+
checksum = "e48ac77174b19c110a50ab2128b24215ac9cb40e0e12e093fb602d175c569d22"
|
|
2712
|
+
dependencies = [
|
|
2713
|
+
"bytes",
|
|
2714
|
+
"data-encoding",
|
|
2715
|
+
"http",
|
|
2716
|
+
"httparse",
|
|
2717
|
+
"log",
|
|
2718
|
+
"rand",
|
|
2719
|
+
"sha1",
|
|
2720
|
+
"thiserror",
|
|
2721
|
+
]
|
|
2722
|
+
|
|
2668
2723
|
[[package]]
|
|
2669
2724
|
name = "typenum"
|
|
2670
2725
|
version = "1.20.1"
|
|
@@ -2694,6 +2749,12 @@ version = "1.0.27"
|
|
|
2694
2749
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2695
2750
|
checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
|
|
2696
2751
|
|
|
2752
|
+
[[package]]
|
|
2753
|
+
name = "unicode-width"
|
|
2754
|
+
version = "0.2.3"
|
|
2755
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2756
|
+
checksum = "ca718471876992059f251e33aafc334346ada08042b7661dd1fe313a9bced557"
|
|
2757
|
+
|
|
2697
2758
|
[[package]]
|
|
2698
2759
|
name = "untrusted"
|
|
2699
2760
|
version = "0.9.0"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "splunk-cli"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.3"
|
|
4
4
|
edition = "2024"
|
|
5
5
|
rust-version = "1.90"
|
|
6
6
|
description = "Search and manage Splunk from the terminal with structured, agent-friendly output"
|
|
@@ -21,18 +21,23 @@ name = "splunk-cli"
|
|
|
21
21
|
path = "src/main.rs"
|
|
22
22
|
|
|
23
23
|
[dependencies]
|
|
24
|
+
base64 = "0.23"
|
|
24
25
|
clap = { version = "4", features = ["derive", "env"] }
|
|
25
26
|
clap_complete = "4"
|
|
26
27
|
serde = { version = "1", features = ["derive"] }
|
|
27
28
|
serde_json = "1"
|
|
28
29
|
dirs = "7"
|
|
30
|
+
futures-util = "0.3"
|
|
29
31
|
keyring = "4.2"
|
|
30
32
|
rpassword = "7"
|
|
31
33
|
sha2 = "0.10"
|
|
32
34
|
reqwest = { version = "0.13", default-features = false, features = ["rustls", "json", "query", "form"] }
|
|
33
35
|
tempfile = "3"
|
|
34
|
-
tokio = { version = "1", features = ["macros", "rt-multi-thread", "time"] }
|
|
36
|
+
tokio = { version = "1", features = ["fs", "io-util", "macros", "net", "process", "rt-multi-thread", "time", "signal"] }
|
|
37
|
+
tokio-tungstenite = "0.30"
|
|
35
38
|
toml = "1.1"
|
|
39
|
+
unicode-width = "0.2"
|
|
40
|
+
terminal_size = "0.4"
|
|
36
41
|
|
|
37
42
|
[dev-dependencies]
|
|
38
43
|
wiremock = "0.6"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.PHONY: build release test lint fmt check conformance clean install release-patch release-minor release-major update-deps
|
|
1
|
+
.PHONY: build release test test-live lint fmt check conformance clean install release-patch release-minor release-major update-deps
|
|
2
2
|
|
|
3
3
|
build:
|
|
4
4
|
cargo build
|
|
@@ -9,6 +9,10 @@ release:
|
|
|
9
9
|
test:
|
|
10
10
|
cargo test --locked
|
|
11
11
|
|
|
12
|
+
# Opt-in, native x86 Docker daemon; supports homelab contexts / DOCKER_HOST.
|
|
13
|
+
test-live:
|
|
14
|
+
bash scripts/test-live.sh
|
|
15
|
+
|
|
12
16
|
lint:
|
|
13
17
|
cargo fmt -- --check
|
|
14
18
|
cargo clippy --locked --all-targets -- -D warnings
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: splunk-cli
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
4
4
|
Classifier: Development Status :: 3 - Alpha
|
|
5
5
|
Classifier: Environment :: Console
|
|
6
6
|
Classifier: Intended Audience :: Developers
|
|
@@ -52,17 +52,23 @@ on port 8000. Splunk Cloud deployments may require REST API access to be enabled
|
|
|
52
52
|
and your source IP to be allowed by an administrator.
|
|
53
53
|
|
|
54
54
|
```sh
|
|
55
|
-
splunk-cli
|
|
56
|
-
|
|
55
|
+
splunk-cli init --profile work
|
|
56
|
+
splunk-cli profile use work
|
|
57
|
+
splunk-cli doctor
|
|
57
58
|
splunk-cli auth status
|
|
58
59
|
splunk-cli server info
|
|
59
60
|
```
|
|
60
61
|
|
|
61
|
-
`auth login` prompts for the management URL (if not already configured), an
|
|
62
|
+
`init` (or `auth login`) prompts for the management URL (if not already configured), an
|
|
62
63
|
authentication method, and a hidden token or password. Credentials are validated
|
|
63
64
|
against Splunk before saving in macOS Keychain, Windows Credential Manager, or
|
|
64
|
-
Linux Secret Service.
|
|
65
|
-
|
|
65
|
+
Linux Secret Service. When no credential store is available (for example on
|
|
66
|
+
WSL), an interactive login asks before saving to `credentials.json` next to the
|
|
67
|
+
config file (mode 0600 on Unix); `--insecure-storage` selects that file without
|
|
68
|
+
asking. Connection settings stay in the TOML config. If an old OS credential cannot
|
|
69
|
+
be removed after saving a file login, a warning explains how to prevent it from
|
|
70
|
+
overriding the new login when the OS store becomes available again.
|
|
71
|
+
Login saves supplied connection settings, including flag/environment overrides.
|
|
66
72
|
|
|
67
73
|
```sh
|
|
68
74
|
splunk-cli auth login --profile work --url https://splunk.example.com:8089 --method token
|
|
@@ -94,16 +100,45 @@ internal certificate authority; `--insecure` disables verification for the curre
|
|
|
94
100
|
invocation. Sending credentials over plain HTTP to a remote host requires
|
|
95
101
|
explicit `--allow-http` (loopback mock/development servers are exempt). HTTP redirects and automatic request retries are disabled.
|
|
96
102
|
|
|
103
|
+
### Browser sign-in (SSO)
|
|
104
|
+
|
|
105
|
+
Deployments that sign in through SAML or another identity provider cannot use
|
|
106
|
+
basic authentication. `auth login --method browser` opens a private browser
|
|
107
|
+
window on Splunk Web, waits up to five minutes for you to complete your normal
|
|
108
|
+
sign-in, and saves the resulting Splunk session for the profile. The CLI never
|
|
109
|
+
sees your identity-provider password.
|
|
110
|
+
|
|
111
|
+
```sh
|
|
112
|
+
splunk-cli config set --profile work \
|
|
113
|
+
--url https://splunk.example.com:8089 \
|
|
114
|
+
--web-url https://splunk.example.com/
|
|
115
|
+
splunk-cli --profile work auth login --method browser
|
|
116
|
+
splunk-cli --profile work search 'index=_internal | head 5'
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
The Splunk Web URL defaults to HTTPS on the management host without a port; set
|
|
120
|
+
`--web-url` (or `SPLUNK_WEB_URL`, or `web_url` in the profile) when Splunk Web
|
|
121
|
+
lives elsewhere or under a path prefix. Chrome, Edge, Chromium and Firefox are
|
|
122
|
+
detected automatically, including Windows browsers from WSL; `--browser` (or
|
|
123
|
+
`SPLUNK_BROWSER`) selects a browser name or executable path. The browser runs
|
|
124
|
+
with a temporary profile that is deleted afterwards. Sessions expire according
|
|
125
|
+
to the server's session timeout; commands then fail with an `auth` error and a
|
|
126
|
+
hint to log in again.
|
|
127
|
+
|
|
97
128
|
## Search
|
|
98
129
|
|
|
99
130
|
```sh
|
|
100
131
|
splunk-cli search 'index=main error | stats count by host' --earliest -1h
|
|
101
132
|
splunk-cli search '| makeresults | eval message="hello"' --fields message
|
|
102
133
|
splunk-cli search 'index=main' --limit 20 --output json
|
|
134
|
+
splunk-cli search --file investigation.spl --earliest -7d
|
|
135
|
+
cat investigation.spl | splunk-cli search --file -
|
|
103
136
|
|
|
104
137
|
# Long-running searches: submit once, then inspect and page the same job.
|
|
105
138
|
splunk-cli jobs create 'index=main | stats count by sourcetype' --earliest -7d
|
|
106
139
|
splunk-cli jobs show JOB_ID
|
|
140
|
+
splunk-cli jobs watch JOB_ID --wait-timeout 600
|
|
141
|
+
splunk-cli jobs wait JOB_ID --quiet
|
|
107
142
|
splunk-cli jobs results JOB_ID --limit 100 --offset 0 --fields sourcetype,count
|
|
108
143
|
splunk-cli jobs results JOB_ID --limit 100 --offset 100
|
|
109
144
|
splunk-cli jobs list --limit 20 --fields name,dispatchState,isDone
|
|
@@ -112,7 +147,7 @@ splunk-cli jobs list --limit 20 --fields name,dispatchState,isDone
|
|
|
112
147
|
Bare expressions such as `index=main` gain a `search` prefix; queries starting
|
|
113
148
|
with `search` or `|` are preserved. Default time bounds are `-24h` through `now`.
|
|
114
149
|
`--timeout` bounds each HTTP request (30 seconds by default); `search
|
|
115
|
-
--wait-timeout` bounds polling (120 seconds by default). A timed-out wait leaves
|
|
150
|
+
--wait-timeout` bounds polling (120 seconds by default). A timed-out or interrupted wait leaves
|
|
116
151
|
the job available, and its ID appears in the structured error. Results are
|
|
117
152
|
returned only after completion; failed, canceled, and running jobs are reported
|
|
118
153
|
explicitly. Results use the v2 API available in Splunk 9.0.1 and later.
|
|
@@ -123,6 +158,32 @@ or dispatch can repeat those effects. There is no claimed idempotency key;
|
|
|
123
158
|
inspect the existing job before resubmitting after an ambiguous failure.
|
|
124
159
|
Use `jobs results JOB_ID` to continue paging rather than running `search` again.
|
|
125
160
|
|
|
161
|
+
## Export completed results
|
|
162
|
+
|
|
163
|
+
```sh
|
|
164
|
+
splunk-cli jobs export JOB_ID --fields _time,host,_raw --output jsonl > events.jsonl
|
|
165
|
+
splunk-cli jobs export JOB_ID --max-results 50000 --page-size 1000 --output csv > results.csv
|
|
166
|
+
# Resume the same job using the previous export's next_offset:
|
|
167
|
+
splunk-cli jobs export JOB_ID --offset 50000 --max-results 50000 --output jsonl >> events.jsonl
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Export fetches pages of an existing completed job; it never creates another
|
|
171
|
+
search. The default bound is 10,000 records, configurable from 1 to 1,000,000,
|
|
172
|
+
with page sizes from 1 to 10,000. The combined record JSON is capped at 32 MiB;
|
|
173
|
+
reaching this bound returns the records that fit and their continuation cursor
|
|
174
|
+
with `byte_limit_reached: true`. Select fields to reduce large events. Results are buffered
|
|
175
|
+
within these bounds, so a failed page produces no partial stdout. JSON exports
|
|
176
|
+
retain the collection envelope, `job_id`, `next_offset`, `next_cursor`, and
|
|
177
|
+
`bounded` (whether more records remain). An empty page before Splunk's reported
|
|
178
|
+
total sets `truncated` and stops; inspect the search job's result limits.
|
|
179
|
+
CSV and JSONL contain records only, with counts and continuation metadata on
|
|
180
|
+
stderr. When written directly to a terminal, CSV escapes control characters
|
|
181
|
+
for safe display; redirected exports preserve raw values. JSON/JSONL use valid
|
|
182
|
+
JSON Unicode escapes for terminal controls without changing decoded values.
|
|
183
|
+
Keep the same `--fields` when appending JSONL. For CSV, combine subsequent
|
|
184
|
+
exports with a CSV-aware tool to avoid duplicate headers. CSV uses the requested
|
|
185
|
+
field order and standard quoting; multi-value fields retain JSON array text.
|
|
186
|
+
|
|
126
187
|
## Saved searches and indexes
|
|
127
188
|
|
|
128
189
|
```sh
|
|
@@ -165,8 +226,9 @@ splunk-cli completions zsh > _splunk-cli
|
|
|
165
226
|
splunk-cli indexes list --output text
|
|
166
227
|
```
|
|
167
228
|
|
|
168
|
-
`--output auto` chooses
|
|
169
|
-
Explicit `--output json|text` always wins
|
|
229
|
+
`--output auto` chooses aligned tables on a terminal and JSON when piped.
|
|
230
|
+
Explicit `--output json|text|csv|jsonl` always wins (`table` aliases `text`,
|
|
231
|
+
`ndjson` aliases `jsonl`). Collection responses use:
|
|
170
232
|
|
|
171
233
|
```json
|
|
172
234
|
{"items":[{"name":"main"}],"total":42,"offset":0,"limit":1,"has_more":true,"next_offset":1}
|
|
@@ -176,16 +238,19 @@ Search results additionally include `job_id` and `next_cursor`.
|
|
|
176
238
|
Pass that cursor to `splunk-cli search --cursor CURSOR` without a query to page
|
|
177
239
|
the same job; this performs only GET requests and never resubmits SPL. Single-record commands return an
|
|
178
240
|
object directly. `--fields` selects exact output keys, including dotted Splunk
|
|
179
|
-
keys. Collection limits default to 100 and allow 1–10000; zero/unlimited is
|
|
241
|
+
keys. SPL files/stdin must be UTF-8 and at most 1 MiB. Collection limits default to 100 and allow 1–10000; zero/unlimited is
|
|
180
242
|
rejected. Unknown totals are `null`; a lookahead record determines `has_more`.
|
|
181
243
|
An unexpectedly empty page with remaining reported results sets `truncated: true`
|
|
182
244
|
and stops continuation to avoid a pagination loop. Responses above 32 MiB fail with an instruction to narrow the page or fields.
|
|
183
|
-
Text mode
|
|
184
|
-
|
|
245
|
+
Text mode shows selected columns for raw events, indexes, jobs, saved searches, and profiles,
|
|
246
|
+
fits terminal width, and escapes event control characters. Use `--fields` to
|
|
247
|
+
choose columns or JSON to preserve every field without display truncation. Output contains no ANSI color and respects `--no-color` and
|
|
185
248
|
`NO_COLOR` by construction.
|
|
186
249
|
|
|
187
250
|
Data goes to stdout; progress and errors go to stderr. `--quiet` suppresses
|
|
188
|
-
progress
|
|
251
|
+
progress, while Splunk warnings and incomplete-export notices remain visible.
|
|
252
|
+
Repeated warnings are deduplicated per invocation (up to 64 distinct messages).
|
|
253
|
+
Closed stdout pipelines (for example, `| head`) exit quietly with success. JSON errors are a single envelope on the last line of stderr:
|
|
189
254
|
|
|
190
255
|
```json
|
|
191
256
|
{"error":{"kind":"auth","message":"No complete credentials configured","exit_code":3}}
|
|
@@ -205,8 +270,9 @@ progress. JSON errors are a single envelope on the last line of stderr:
|
|
|
205
270
|
| 10 | `transport` | Network or TLS failure |
|
|
206
271
|
| 11 | `invalid_response` | Unexpected, malformed, or oversized response |
|
|
207
272
|
| 12 | `io` | Local filesystem or output failure |
|
|
273
|
+
| 130 | `interrupted` | Stopped waiting; existing search job preserved |
|
|
208
274
|
|
|
209
|
-
|
|
275
|
+
Only `init` and `auth login` prompt for input. Schema, help, version, and completions work without
|
|
210
276
|
a connection or configuration. The schema is derived from the parser's actual
|
|
211
277
|
arguments, and includes side effects, output shapes, pagination, and error codes.
|
|
212
278
|
The v0.3 specification is a candidate; this repository vendors the version used
|
|
@@ -215,30 +281,63 @@ by its conformance tests. The CLI and its output contract are experimental.
|
|
|
215
281
|
## Profiles
|
|
216
282
|
|
|
217
283
|
Settings resolve in this order: command-line flags, environment, selected
|
|
218
|
-
profile, defaults.
|
|
284
|
+
profile, defaults. Profile selection uses `--profile`, then `SPLUNK_PROFILE`,
|
|
285
|
+
then the saved `active_profile`, then `default`. `SPLUNK_CONFIG` or `--config` overrides the file location;
|
|
219
286
|
otherwise it is `$XDG_CONFIG_HOME/splunk-cli/config.toml` or
|
|
220
287
|
`~/.config/splunk-cli/config.toml`.
|
|
221
288
|
|
|
222
289
|
```toml
|
|
290
|
+
active_profile = "work"
|
|
291
|
+
|
|
223
292
|
[profiles.work]
|
|
224
293
|
url = "https://splunk.example.com:8089"
|
|
225
294
|
app = "search"
|
|
226
295
|
owner = "nobody"
|
|
227
296
|
timeout = 30
|
|
297
|
+
# web_url = "https://splunk.example.com/"
|
|
228
298
|
# ca_cert = "/path/to/internal-ca.pem"
|
|
229
299
|
```
|
|
230
300
|
|
|
231
301
|
`config set` saves the supplied flag/environment settings to the selected profile,
|
|
232
|
-
retaining other settings and profiles. Writes are locked and atomic, and use
|
|
233
|
-
private file permissions on Unix.
|
|
302
|
+
retaining other settings and profiles. Writes are locked and atomic, preserve config symlinks, and use
|
|
303
|
+
private file permissions on Unix. Config writes normalize TOML formatting;
|
|
304
|
+
paths must be UTF-8. `config set --dry-run` previews the change.
|
|
234
305
|
`config show` displays the resolved settings; `config path` shows only the path.
|
|
235
306
|
Credentials, `--insecure`, and `--allow-http` are never persisted. Certificate
|
|
236
307
|
paths supplied through `config set` are saved as absolute paths.
|
|
237
308
|
|
|
309
|
+
```sh
|
|
310
|
+
splunk-cli profile list
|
|
311
|
+
splunk-cli profile use work
|
|
312
|
+
splunk-cli profile remove old --dry-run
|
|
313
|
+
splunk-cli profile remove old --yes
|
|
314
|
+
splunk-cli auth status --offline
|
|
315
|
+
splunk-cli doctor --offline
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
`profile remove` deletes local connection settings and the saved credential for
|
|
319
|
+
that profile's configured server, without revoking remote tokens. It requires
|
|
320
|
+
an accessible credential store when the profile has a valid URL; a failed
|
|
321
|
+
deletion preserves settings. In a headless environment, explicitly pass
|
|
322
|
+
`--keep-credentials` to remove settings while leaving saved credentials untouched;
|
|
323
|
+
`credentials_removed` is then `null` and a warning is printed. Profile lists mark
|
|
324
|
+
invalid settings with `valid: false` and hide invalid URLs. Use
|
|
325
|
+
`--keep-credentials` to remove a profile whose URL is malformed. Credentials for historical URLs should be removed with
|
|
326
|
+
`auth logout --url OLD_URL` before removing the profile. Removing the saved active
|
|
327
|
+
profile resets selection to `default`; create or select another profile if needed.
|
|
328
|
+
|
|
329
|
+
`auth status --offline` reports availability, source, and method; it returns
|
|
330
|
+
`authenticated: null` because no server validation occurred. `doctor --offline`
|
|
331
|
+
also checks configuration and certificate/client setup. Online `doctor` validates
|
|
332
|
+
authentication, management API access, the selected job namespace, and visible
|
|
333
|
+
indexes using read-only requests. It never submits SPL or tests write permissions.
|
|
334
|
+
Failures use the normal exit code and error envelope, with completed and failed
|
|
335
|
+
checks in `error.details.checks` and an actionable hint.
|
|
336
|
+
|
|
238
337
|
| Variable | Setting |
|
|
239
338
|
|---|---|
|
|
240
339
|
| `SPLUNK_URL` | Management base URL |
|
|
241
|
-
| `SPLUNK_PROFILE` |
|
|
340
|
+
| `SPLUNK_PROFILE` | Override the saved active profile |
|
|
242
341
|
| `SPLUNK_CONFIG` | Configuration file path |
|
|
243
342
|
| `SPLUNK_APP` | Application namespace |
|
|
244
343
|
| `SPLUNK_OWNER` | Owner namespace |
|
|
@@ -253,9 +352,12 @@ cargo +1.90.0 check --locked --all-targets
|
|
|
253
352
|
make conformance # requires the clispec v0.3 scorer
|
|
254
353
|
```
|
|
255
354
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
355
|
+
The default tests use local HTTP servers and require no Splunk account. Run
|
|
356
|
+
`SPLUNK_ACCEPT_LICENSE=yes make test-live` for opt-in checks against a disposable
|
|
357
|
+
Splunk server on a native x86 Docker daemon, including saved terminal login,
|
|
358
|
+
token expiry, profile isolation, searches, jobs, saved searches, and indexes.
|
|
359
|
+
Docker contexts and `DOCKER_HOST` support homelab execution; see the
|
|
360
|
+
[live test instructions](tests/live/README.md). Endpoint behavior follows Splunk's
|
|
259
361
|
[search API reference](https://help.splunk.com/en/splunk-enterprise/rest-api-reference/10.2/search-endpoints/search-endpoint-descriptions)
|
|
260
362
|
and [authentication documentation](https://help.splunk.com/en/splunk-enterprise/administer/manage-users-and-security/10.2/authenticate-into-the-splunk-platform-with-tokens/use-authentication-tokens).
|
|
261
363
|
|