Skip to main content

Command line wrapper for Elasticsearch CAT API

Project description

# Elasticsearch cat CLI
Basic Elasticsearch cat API command line wrapper with multi-cluster support

#### Features:
- Complete coverage of all Elasticsearch `cat` modules
- Exposed `cat` API call options as command line arguments
- Get output in form of json, yaml or text
- Manage multiple clusters using profiles
- Support for SSL and Password authentication

### Installation:
**Requirements**:
- python3
- pip

**Installation instructions**
- Install using pip
```
pip install escat
```
- Create a file config file as described in the Configuration section. If you would like to quickly get started, just use the following format and create that file in the destination `~/.escat/config.yml`
```yaml
clusters:
default:
hosts: ["http://localhost:9200"]
```

### Configuration
Example configuration
```yaml
clusters:
default:
hosts: ['http://localhost:9200']
# auth:
# username: 'elastic'
# password:
# ask: yes
# value: 'elastic'
# ssl:
# enabled: no
# cert: ''
# ca: []
# private_key: ''
# verify_certs: yes
```
The contents of the file are pretty self explanatory. The keys: `auth` and `ssl` are disabled but visible for reference on how to configure authentication for the requests sent to Elasticsearch. Below mentioned is a multi cluster configuration. For the rest of the documentation, we are going to use this configuration file to run commands:
```yaml
clusters:
default:
hosts: ['http://localhost:9200']
dev:
hosts: ['https://dev-es-1:9200', 'https://dev-es-2:9200']
prod:
hosts: ['https://prod-es-1:9200', 'https://prod-es-2:9200']
ssl:
enabled: yes
cert: '~/.openssl/certs/prod-es-cert.cert'
ca: ['~/.openssl/cas/prod-ca-1.cert', '~/.openssl/cas/prod-ca-2.cert']
private_key: '~/.openssl/certs/prod-es-cert.key'
verify_certs: yes
```
If you set a config like this:
```yaml
clusters:
default:
hosts: ['http://localhost:9200']
auth:
username: 'elastic'
password:
ask: yes
```
You will be asked for the password on a command line.
### Running
To understand some options, please refer the config example directly above
Get help for commands
```
escat -h
```
Get cluster health for default cluster
```
escat health
```
Get count for selective indices in the dev cluster
```
escat --cluster dev count --indices "dev-test"
```
Get recovery information on prod cluster in json format
```
escat --cluster prod --format json recovery
```
Use a different config file
```
escat --config ~/.es.yml --cluster dev health
```

### Contributing
Please raise github issues related to questions, feature requests or troubleshooting. Also, to make debug person's life easier, one should always include the following information:
- Command ran
- Operating system
- Python version
- Elasticsearch version

Currently, the escat is only tested on Python 3.6.5 on Ubuntu 16.04, Windows 10, and Mac OSX.
PRs are welcome. Do mention the description in brief what the PR would fix. If the PR is in a form of checklist, it would be amazing.

### Resources
[Elasticsearch cat API](https://www.elastic.co/guide/en/elasticsearch/reference/current/cat.html)


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

escat-1.0.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

escat-1.0.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file escat-1.0.0.tar.gz.

File metadata

  • Download URL: escat-1.0.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for escat-1.0.0.tar.gz
Algorithm Hash digest
SHA256 61cb017db81496a0ef76b75a251826f065e3ce739376da3de8b5ff6e2b8d2076
MD5 c24cd6dcc1e4a1b51321220fc8f29458
BLAKE2b-256 9a590d9356174f05e486280ce3476fb2e001b32524431cc662eec7752638786e

See more details on using hashes here.

File details

Details for the file escat-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for escat-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 54b3afca18cb075ad099ea99d5cdcb85a32822d1192c92cd3d5a702c69e9f306
MD5 c8c2d352d2b0699d655b82747b1cc2f0
BLAKE2b-256 c3a6d0bb2afa636cdaf3622cbbcb5c7f943763d4f032b2506364f3014f7c03a4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page