Giter VIP home page Giter VIP logo

glog-cli's Introduction

Glog-CLI

  • Free software: Apache Software License 2.0

Glog-CLI is an open source command line interface for Graylog2.

Instalation

Requirements: Python 2

Try:

pip install glogcli

or:

easy_install glogcli

or you can even install it from a GitHub clone:

git clone https://github.com/globocom/glog-cli
cd glog-cli/
pip install . -r requirements.txt

Usage

Glog-CLI enables you to make searches using the official Graylog query language. To understand how to make queries please see the documentation.

Once you've installed the tool now it's time to run some commands, the following:

glogcli -h mygraylog.server.com -u john.doe -p password -@ "10 minutes ago" "source:my-app-server"
glogcli -h mygraylog.server.com -u john.doe -p password "message:200"
glogcli -h mygraylog.server.com -u john.doe -p password -f
glogcli -h mygraylog.server.com -u john.doe -p password "level:DEBUG"
glogcli -h mygraylog.server.com -u john.doe -p password "level:DEBUG" -f
glogcli -h mygraylog.server.com -u john.doe -p password "level:DEBUG" -d --fields timestamp,level,message -o dump.csv
glogcli -h mygraylog.server.com -u john-doe -p password -@ "2016-11-21 00:00:00" -# "2016-11-21 01:00:00" 'message:blabla'
glogcli -e dev -r short
glogcli -e dev -r short -st mystreamid
glogcli -e dev -r short -st '*'

Configuration

Glog-CLI can reuse some common configurations like address of your Graylog server and your credentials, it will look for a ~/.glogcli.cfg or a glogcli.cfg (in your current directory). Glog-CLI will use default environment and format whenever an environment or format is omitted.

Here is a example for your glogcli.cfg file:

[environment:default]
host=mygraylogserver.com
port=443
username=john.doe

[environment:dev]
host=mygraylogserver.dev.com
port=443
proxy=mycompanyproxy.com
username=john.doe
default_stream=57e14cde6fb78216a60d35e8

[format:default]
format={host} {level} {facility} {timestamp} {message}
    
[format:short]
format=[{timestamp}] {level} {message}
    
[format:long]
format=time: [{timestamp}] level: {level} msg: {message} tags: {tags}
color=false

Please run the help command to more detailed information about all the client features.

Usage: glogcli [OPTIONS] [QUERY]

Options:
  -v, --version                   Prints your glogcli version
  -h, --host TEXT                 Your graylog node's host
  -e, --environment TEXT          Label of a preconfigured graylog node
  -sq, --saved-query              List user saved queries for selection
  --port TEXT                     Your graylog port
  --no-tls                        Not use TLS to connect to Graylog server
  -u, --username TEXT             Your graylog username
  -p, --password TEXT             Your graylog password (default: prompt)
  -k, --keyring / -nk, --no-keyring
                                  Use keyring to store/retrieve password
  -@, --search-from TEXT          Query range from
  -#, --search-to TEXT            Query range to (default: now)
  --tail                          Show the last n lines for the query
                                  (default)
  -d, --dump                      Print the query result as a csv
  --fields TEXT                   Comma separated fields to be printed in the
                                  csv.
  -o, --output TEXT               Output logs to file (only tail/dump mode)
  -f, --follow                    Poll the logging server for new logs
                                  matching the query (sets search from to now,
                                  limit to None)
  -n, --limit INTEGER             Limit the number of results (default: 100)
  -a, --latency INTEGER           Latency of polling queries (default: 2)
  -st, --stream TEXT              Stream ID of the stream to query (default:
                                  no stream filter)
  -s, --sort TEXT                 Field used for sorting (default: timestamp)
  --asc / --desc                  Sort ascending / descending
  --proxy TEXT                    Proxy to use for the http/s request
  -r, --format-template TEXT      Message format template for the log
                                  (default: default format
  --no-color                      Don't show colored logs
  -c, --config TEXT               Custom config file path
  --help                          Show this message and exit.

Contributing

See contributing document to learn how to contribute with us.

glog-cli's People

Contributors

sinvalmendes avatar victor-mendes-eduardo avatar pantuza avatar ccasado avatar achimgrimm avatar nelson-marcos avatar pedrosnk avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.