CLI harness for Sumo Logic log search API — agent-friendly interface
Project description
cli-anything-sumologic
CLI harness for the Sumo Logic Search Job API. Run Sumo Logic log searches from the command line or from AI agents.
Prerequisites
A Sumo Logic account with API access. No additional software installation required — the CLI calls the Sumo Logic REST API directly over HTTPS.
You will need:
- Access ID and Access Key from your Sumo Logic account (Preferences → Access Keys)
- API endpoint for your deployment (e.g.
https://api.us2.sumologic.com/api/v1)
Installation
cd agent-harness
pip install -e .
Verify:
which cli-anything-sumologic
cli-anything-sumologic --help
Configuration
Option 1: Environment variables (recommended for agents)
export SUMO_ENDPOINT="https://api.us2.sumologic.com/api/v1"
export SUMO_ACCESS_ID="your-access-id"
export SUMO_ACCESS_KEY="your-access-key"
Option 2: Interactive configure
cli-anything-sumologic auth configure
Credentials are stored in ~/.cli-anything-sumologic/session.json.
Usage
Interactive REPL
cli-anything-sumologic
One-shot commands
# Run a search (last 15 minutes) — TOON output by default
cli-anything-sumologic search run "error | count by _sourceCategory"
# Search with explicit time range
cli-anything-sumologic search run "exception" --from "-1h" --to "now"
# Full indented JSON output (no truncation)
cli-anything-sumologic --format json search run "* | limit 10" --from "-5m"
# Human-readable text
cli-anything-sumologic --format text search run "* | limit 10" --from "-5m"
# Save a query for reuse
cli-anything-sumologic search save my-errors "error | count" --from "-1h"
# Replay a saved query
cli-anything-sumologic search replay my-errors
# Show credential status
cli-anything-sumologic auth status
# Test credentials
cli-anything-sumologic auth test
Command Groups
| Group | Commands | Description |
|---|---|---|
auth |
configure, status, test |
Manage credentials |
search |
run, history, saved, save, delete-saved, replay |
Log searches |
job |
status, messages, records, delete |
Manage search jobs |
session |
info, clear-history |
Session state |
Output Formats
| Flag | Description |
|---|---|
| (no flag) | TOON — Token-Oriented Object Notation (default, token-efficient) |
--format toon |
Same as default |
--format json |
Full indented JSON |
--format text |
Human-readable tables (always used inside the REPL) |
--no-truncation |
Disable field truncation entirely |
TOON uses YAML-like key-value pairs for objects and tabular CSV rows for uniform arrays (field names declared once per array). Field truncation is applied before encoding to both toon and json formats.
Default truncation limits (overridable via env vars):
| Env var | Default | Controls |
|---|---|---|
SUMO_TRUNCATE_STR |
2000 |
Max string length in chars |
SUMO_TRUNCATE_LIST |
20 |
Max items kept from any list |
SUMO_TRUNCATE_DICT |
30 |
Max keys kept from any dict |
--json is a hidden alias for --format json kept for backward compatibility.
Agent Usage (TOON mode — default)
# Credentials check
cli-anything-sumologic auth status
# Run search, parse results — output is compact JSON with truncation
cli-anything-sumologic search run "error | count by _host" --from "-1h"
# {"job_id":"...","is_aggregate":true,"record_count":5,"fields":[...],"records":[{"_host":"web-01","_count":"42"},...]}
# Full JSON when you need untruncated data
cli-anything-sumologic --format json search run "error | count by _host" --from "-1h"
# Dry-run to preview query params
cli-anything-sumologic search run "error" --dry-run --from "-1h"
Running Tests
Unit tests (no credentials needed)
cd agent-harness
pip install -e .
pytest cli_anything/sumologic/tests/test_core.py -v
E2E tests (requires live Sumo Logic credentials)
export SUMO_ENDPOINT="https://api.us2.sumologic.com/api/v1"
export SUMO_ACCESS_ID="your-id"
export SUMO_ACCESS_KEY="your-key"
CLI_ANYTHING_FORCE_INSTALLED=1 pytest cli_anything/sumologic/tests/test_full_e2e.py -v -s
Deployment Endpoints
| Region | Endpoint |
|---|---|
| US1 | https://api.sumologic.com/api/v1 |
| US2 | https://api.us2.sumologic.com/api/v1 |
| EU | https://api.eu.sumologic.com/api/v1 |
| AU | https://api.au.sumologic.com/api/v1 |
| IN | https://api.in.sumologic.com/api/v1 |
| JP | https://api.jp.sumologic.com/api/v1 |
| CA | https://api.ca.sumologic.com/api/v1 |
| FED | https://api.fed.sumologic.com/api/v1 |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cli_anything_sumologic-1.2.0.tar.gz.
File metadata
- Download URL: cli_anything_sumologic-1.2.0.tar.gz
- Upload date:
- Size: 33.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d2c69c9bac60b0448ddd5df7bc4550d06267af04f369d96f202270558a83f7b
|
|
| MD5 |
98c580a9ec57aed952c32cf328717eba
|
|
| BLAKE2b-256 |
a8115cc8cef5e126a512674a0b26683518ca700e7dac220aad0246a9725ed1b5
|
File details
Details for the file cli_anything_sumologic-1.2.0-py3-none-any.whl.
File metadata
- Download URL: cli_anything_sumologic-1.2.0-py3-none-any.whl
- Upload date:
- Size: 38.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed308b9bb98724aca7ec6969bd9fe6860b99ffa2f7aed0095d6b04840892a7f1
|
|
| MD5 |
c5c6d1101fc89bfa49733bb331cf2763
|
|
| BLAKE2b-256 |
c9c920533434ec1ab5decd1d94ecea45e5c5fc63579690d88f63cfa456b72b63
|