loggly-clilisted
Install: claude install-skill abdullahkhawer/devops-skills
# Loggly CLI Skill
Use the instance and rules below when constructing all Loggly API commands.
## Configuration
Update the table below with your Loggly subdomain and credential file paths:
| Environment | Subdomain | Token File |
|---|---|---|
| Production | `<your-prod-subdomain>` | `~/.loggly/prod.token` |
| Staging | `<your-staging-subdomain>` | `~/.loggly/staging.token` |
If the target environment is unclear, ask the user before running any command.
## Prerequisites (one-time setup by user)
Generate a Loggly API token (**Account Settings → API Tokens**) for each environment and save it to the corresponding token file. Never print or display token values. Do not perform these steps yourself.
```bash
mkdir -p ~/.loggly && echo "<your-api-token>" > <TOKEN_FILE> && chmod 600 <TOKEN_FILE>
```
## Command Format
```bash
curl -s -u "$(cat <TOKEN_FILE>):" \
"https://<subdomain>.loggly.com/apiv2/<endpoint>" | jq .
```
## Available API Endpoints
### Read-only (safe, no confirmation needed)
| Endpoint | Method | Description |
|---|---|---|
| `/apiv2/search` | GET | Run a search query, returns an `rsid` |
| `/apiv2/events?rsid=<id>` | GET | Fetch results for a search job |
| `/apiv2/search/list` | GET | List saved searches |
| `/apiv2/sources/groups` | GET | List source groups |
| `/apiv2/fields` | GET | List indexed fields |
### Example — search logs
```bash
RSID=$(curl -s -u "$(cat <TOKEN_FILE>):" \
"https://<subdomain>.loggly.com/apiv2/search?q=<query>&from=-1h&u