splunk-cli 0.0.1__py3-none-macosx_11_0_arm64.whl

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.
Binary file
@@ -0,0 +1,241 @@
1
+ Metadata-Version: 2.4
2
+ Name: splunk-cli
3
+ Version: 0.0.1
4
+ Classifier: Development Status :: 3 - Alpha
5
+ Classifier: Environment :: Console
6
+ Classifier: Intended Audience :: Developers
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Operating System :: OS Independent
9
+ Classifier: Programming Language :: Rust
10
+ Classifier: Topic :: Utilities
11
+ License-File: LICENSE
12
+ Summary: Search and manage Splunk from the terminal with structured, agent-friendly output
13
+ Home-Page: https://github.com/rvben/splunk-cli
14
+ Author: Ruben J. Jongejan
15
+ License: MIT
16
+ Requires-Python: >=3.8
17
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
18
+ Project-URL: Homepage, https://github.com/rvben/splunk-cli
19
+ Project-URL: Repository, https://github.com/rvben/splunk-cli
20
+
21
+ # splunk-cli
22
+
23
+ A Rust CLI for searching and inspecting Splunk from a terminal, scripts, and
24
+ agents. Uses Splunk's management REST API, with an offline [clispec v0.3](https://clispec.dev)
25
+ contract, paginated JSON, and stable errors.
26
+
27
+ The binary is named `splunk-cli` so it can coexist with Splunk's bundled `splunk`
28
+ command. This is an independent project, unaffiliated with Splunk.
29
+
30
+ ## Install
31
+
32
+ ```sh
33
+ uv tool install splunk-cli
34
+ # Or run without installing:
35
+ uvx splunk-cli --help
36
+ # pipx works too:
37
+ pipx install splunk-cli
38
+ ```
39
+
40
+ PyPI distributions include native wheels for Linux and macOS (x64/ARM64), and
41
+ Windows x64, plus a source distribution. Building from source requires Rust 1.90
42
+ or newer:
43
+
44
+ ```sh
45
+ cargo install --path . --locked
46
+ ```
47
+
48
+ ## Connect
49
+
50
+ Use the **management URL**, usually port 8089, rather than the Splunk Web URL
51
+ on port 8000. Splunk Cloud deployments may require REST API access to be enabled
52
+ and your source IP to be allowed by an administrator.
53
+
54
+ ```sh
55
+ splunk-cli config set --profile work --url https://splunk.example.com:8089
56
+ export SPLUNK_PROFILE=work
57
+ # Supply SPLUNK_TOKEN through your secret manager or environment.
58
+ splunk-cli auth status
59
+ splunk-cli server info
60
+ ```
61
+
62
+ Authentication accepts exactly one of:
63
+
64
+ - `SPLUNK_TOKEN`: authentication token sent as `Authorization: Bearer …`.
65
+ - `SPLUNK_SESSION_KEY`: existing session key sent as `Authorization: Splunk …`.
66
+ - `SPLUNK_USERNAME` and `SPLUNK_PASSWORD`: HTTP basic authentication.
67
+
68
+ Secrets are never accepted as command-line flags or stored in profiles.
69
+ Use a least-privilege Splunk account; access follows that account's permissions.
70
+ TLS certificates are verified by default. `--ca-cert /path/to/ca.pem` adds an
71
+ internal certificate authority; `--insecure` disables verification for the current
72
+ invocation. Sending credentials over plain HTTP to a remote host requires
73
+ explicit `--allow-http` (loopback mock/development servers are exempt). HTTP redirects and automatic request retries are disabled.
74
+
75
+ ## Search
76
+
77
+ ```sh
78
+ splunk-cli search 'index=main error | stats count by host' --earliest -1h
79
+ splunk-cli search '| makeresults | eval message="hello"' --fields message
80
+ splunk-cli search 'index=main' --limit 20 --output json
81
+
82
+ # Long-running searches: submit once, then inspect and page the same job.
83
+ splunk-cli jobs create 'index=main | stats count by sourcetype' --earliest -7d
84
+ splunk-cli jobs show JOB_ID
85
+ splunk-cli jobs results JOB_ID --limit 100 --offset 0 --fields sourcetype,count
86
+ splunk-cli jobs results JOB_ID --limit 100 --offset 100
87
+ splunk-cli jobs list --limit 20 --fields name,dispatchState,isDone
88
+ ```
89
+
90
+ Bare expressions such as `index=main` gain a `search` prefix; queries starting
91
+ with `search` or `|` are preserved. Default time bounds are `-24h` through `now`.
92
+ `--timeout` bounds each HTTP request (30 seconds by default); `search
93
+ --wait-timeout` bounds polling (120 seconds by default). A timed-out wait leaves
94
+ the job available, and its ID appears in the structured error. Results are
95
+ returned only after completion; failed, canceled, and running jobs are reported
96
+ explicitly. Results use the v2 API available in Splunk 9.0.1 and later.
97
+
98
+ Submitting a search creates a new job. **SPL can write data** through commands
99
+ such as `collect`, `outputlookup`, and app-provided commands. Repeating a search
100
+ or dispatch can repeat those effects. There is no claimed idempotency key;
101
+ inspect the existing job before resubmitting after an ambiguous failure.
102
+ Use `jobs results JOB_ID` to continue paging rather than running `search` again.
103
+
104
+ ## Saved searches and indexes
105
+
106
+ ```sh
107
+ splunk-cli saved-searches list --fields name,search,disabled
108
+ splunk-cli saved-searches show 'Daily errors'
109
+ splunk-cli saved-searches run 'Daily errors'
110
+ splunk-cli indexes list --fields name,totalEventCount,currentDBSizeMB
111
+ splunk-cli indexes show main
112
+ ```
113
+
114
+ Searches, jobs, and saved searches use `/servicesNS/OWNER/APP`; the defaults are
115
+ `nobody/search`. Pass `--owner USER --app APP` to access a different namespace.
116
+ Use `--owner=- --app=-` for cross-namespace discovery. If a definition matches
117
+ multiple resources, `show` refuses the ambiguous result; select an explicit
118
+ owner and app. Saved-search dispatch sets `trigger_actions=0` to disable alert
119
+ actions, while the SPL itself still runs with its normal effects.
120
+
121
+ ## Preview and job cleanup
122
+
123
+ ```sh
124
+ splunk-cli search 'index=main | stats count' --dry-run
125
+ splunk-cli saved-searches run 'Daily errors' --dry-run
126
+ splunk-cli jobs cancel JOB_ID --dry-run
127
+ splunk-cli jobs cancel JOB_ID --yes
128
+ splunk-cli jobs delete JOB_ID --yes
129
+ ```
130
+
131
+ Dry runs make no network requests and need no credentials. Cancel and delete
132
+ require `--yes` in both interactive and non-interactive use. Deleting or canceling
133
+ a missing job is a successful no-op (`changed: false`). Cancellation cannot
134
+ undo effects the SPL has already performed.
135
+
136
+ ## Output and discovery
137
+
138
+ ```sh
139
+ splunk-cli schema
140
+ splunk-cli schema jobs results
141
+ splunk-cli schema saved-searches
142
+ splunk-cli completions zsh > _splunk-cli
143
+ splunk-cli indexes list --output text
144
+ ```
145
+
146
+ `--output auto` chooses tab-separated text on a terminal and JSON when piped.
147
+ Explicit `--output json|text` always wins. Collection responses use:
148
+
149
+ ```json
150
+ {"items":[{"name":"main"}],"total":42,"offset":0,"limit":1,"has_more":true,"next_offset":1}
151
+ ```
152
+
153
+ Search results additionally include `job_id` and `next_cursor`.
154
+ Pass that cursor to `splunk-cli search --cursor CURSOR` without a query to page
155
+ the same job; this performs only GET requests and never resubmits SPL. Single-record commands return an
156
+ object directly. `--fields` selects exact output keys, including dotted Splunk
157
+ keys. Collection limits default to 100 and allow 1–10000; zero/unlimited is
158
+ rejected. Unknown totals are `null`; a lookahead record determines `has_more`.
159
+ An unexpectedly empty page with remaining reported results sets `truncated: true`
160
+ and stops continuation to avoid a pagination loop. Responses above 32 MiB fail with an instruction to narrow the page or fields.
161
+ Text mode JSON-escapes values to keep event control characters from affecting
162
+ the terminal. Output contains no ANSI color and respects `--no-color` and
163
+ `NO_COLOR` by construction.
164
+
165
+ Data goes to stdout; progress and errors go to stderr. `--quiet` suppresses
166
+ progress. JSON errors are a single envelope on the last line of stderr:
167
+
168
+ ```json
169
+ {"error":{"kind":"auth","message":"No complete credentials configured","exit_code":3}}
170
+ ```
171
+
172
+ | Exit | Kind | Meaning |
173
+ |---:|---|---|
174
+ | 0 | — | Success |
175
+ | 2 | `usage` | Invalid arguments or configuration |
176
+ | 3 | `auth` | Missing credentials, rejected credentials, or denied access |
177
+ | 4 | `not_found` | Missing resource |
178
+ | 5 | `api` | Splunk API error or failed search |
179
+ | 6 | `rate_limit` | Rate limited; `details.retry_after` when supplied |
180
+ | 7 | `conflict` | Ambiguous resource or results not yet complete |
181
+ | 8 | `confirmation_required` | Missing `--yes` |
182
+ | 9 | `timeout` | HTTP request or search wait timed out |
183
+ | 10 | `transport` | Network or TLS failure |
184
+ | 11 | `invalid_response` | Unexpected, malformed, or oversized response |
185
+ | 12 | `io` | Local filesystem or output failure |
186
+
187
+ No command prompts for input. Schema, help, version, and completions work without
188
+ a connection or configuration. The schema is derived from the parser's actual
189
+ arguments, and includes side effects, output shapes, pagination, and error codes.
190
+ The v0.3 specification is a candidate; this repository vendors the version used
191
+ by its conformance tests. The CLI and its output contract are experimental.
192
+
193
+ ## Profiles
194
+
195
+ Settings resolve in this order: command-line flags, environment, selected
196
+ profile, defaults. `SPLUNK_CONFIG` or `--config` overrides the file location;
197
+ otherwise it is `$XDG_CONFIG_HOME/splunk-cli/config.toml` or
198
+ `~/.config/splunk-cli/config.toml`.
199
+
200
+ ```toml
201
+ [profiles.work]
202
+ url = "https://splunk.example.com:8089"
203
+ app = "search"
204
+ owner = "nobody"
205
+ timeout = 30
206
+ # ca_cert = "/path/to/internal-ca.pem"
207
+ ```
208
+
209
+ `config set` saves the supplied flag/environment settings to the selected profile,
210
+ retaining other settings and profiles. Writes are locked and atomic, and use
211
+ private file permissions on Unix. `config set --dry-run` previews the change.
212
+ `config show` displays the resolved settings; `config path` shows only the path.
213
+ Credentials, `--insecure`, and `--allow-http` are never persisted. Certificate
214
+ paths supplied through `config set` are saved as absolute paths.
215
+
216
+ | Variable | Setting |
217
+ |---|---|
218
+ | `SPLUNK_URL` | Management base URL |
219
+ | `SPLUNK_PROFILE` | Profile name (default `default`) |
220
+ | `SPLUNK_CONFIG` | Configuration file path |
221
+ | `SPLUNK_APP` | Application namespace |
222
+ | `SPLUNK_OWNER` | Owner namespace |
223
+ | `SPLUNK_TIMEOUT` | Per-request timeout in seconds |
224
+ | `SPLUNK_CA_CERT` | Additional PEM certificate authority |
225
+
226
+ ## Development
227
+
228
+ ```sh
229
+ make check # formatting, Clippy, and mock API / CLI tests
230
+ cargo +1.90.0 check --locked --all-targets
231
+ make conformance # requires the clispec v0.3 scorer
232
+ ```
233
+
234
+ Tests use local HTTP servers and require no Splunk account. Real-instance
235
+ verification is a separate step; no live Splunk service was used during initial
236
+ development. Endpoint behavior follows Splunk's
237
+ [search API reference](https://help.splunk.com/en/splunk-enterprise/rest-api-reference/10.2/search-endpoints/search-endpoint-descriptions)
238
+ 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).
239
+
240
+ Releases use [vership](docs/releases.md). Licensed under [MIT](LICENSE).
241
+
@@ -0,0 +1,6 @@
1
+ splunk_cli-0.0.1.data/scripts/splunk-cli,sha256=88b0EZLRglAm4JQtpTqxBtGmPEbVZRolZfFMzigqyMo,4779520
2
+ splunk_cli-0.0.1.dist-info/METADATA,sha256=GjCgMRTujLFpTFSJyjkrCVp2jmgiq_J0AZ-bf0OXVlc,10317
3
+ splunk_cli-0.0.1.dist-info/WHEEL,sha256=7m8kjhP_K0tQ6qXK8P1IG2YeRznSaoXUEpeK3IfZx-I,102
4
+ splunk_cli-0.0.1.dist-info/licenses/LICENSE,sha256=C-fnAxNl5_rkYD0NgIn5gEeZxx-ew8mOfqo_HJk3t4k,1101
5
+ splunk_cli-0.0.1.dist-info/sboms/splunk-cli.cyclonedx.json,sha256=AXDT_jxTyay3wIlfWb35284_UNRKF9larPu6xlqQdsc,183694
6
+ splunk_cli-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.14.1)
3
+ Root-Is-Purelib: false
4
+ Tag: py3-none-macosx_11_0_arm64
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ruben J. Jongejan <ruben.jongejan@gmail.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.