es-cli
Elasticsearch CLI for querying your logs
Last updated 5 years ago by tjholowaychuk .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install es-cli 
SYNC missed versions from official npm registry.

es-cli

Elastic search CLI for nodejs, using elucene to provide FIELDS, SORT, and LIMIT.

Installation

$ npm install -g es-cli

Usage


  Usage: es [options] [query]

  Options:

    -h, --help       output usage information
    -V, --version    output the version number
    -u, --url <url>  elastic search url
    -c, --count      output result count
    -T, --types      output log types
    -S, --stats      output log stats


Setup

Since manually specifying --url is annoying, you may want to alias this executable:

alias logs='es -u <es-url> --index logs --type log'

Allowing you to simply run:

$ logs level:error AND hostname:api6-1

Example

Check out the last 10 errors:

$ es -u <es-url> level:error

Check out the last 1000 events for the users luna and tobi:

$ es -u <es-url> user:luna OR user:tobi LIMIT 1000

Limit the number of results and sort:

$ es -u <es-url> level:error LIMIT 10 SORT timestamp:desc

Specify the fields to respond with:

$ es -u <es-url> level:error FIELDS message
$ es -u <es-url> login FIELDS id name

Log format

Log objects should use the following format:

{ timestamp: <timestamp>,
  hostname: <hostname>,
  message: <message-json>,
  level: <log-level>,
  type: <log-type> }

For example:

{ timestamp: 1390948474720,
  hostname: 'data',
  message: '{"foo":"bar"}',
  level: 'info',
  type: 'user logout' }

License

MIT

Current Tags

  • 0.4.1                                ...           latest (5 years ago)

10 Versions

  • 0.4.1                                ...           5 years ago
  • 0.4.0                                ...           5 years ago
  • 0.3.4                                ...           5 years ago
  • 0.3.3                                ...           5 years ago
  • 0.3.2                                ...           5 years ago
  • 0.3.1                                ...           5 years ago
  • 0.3.0                                ...           5 years ago
  • 0.2.0                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
  • 0.0.1                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 20
Last Day 0
Last Week 10
Last Month 1
Dependencies (10)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |