Code Monkey home page Code Monkey logo

logstash-shipper's Introduction

UPDATE!

It looks like someone has taken this and made it like over 9000 times better:

https://github.com/josegonzalez/beaver

I'll still keep this repo around and maintain it but if you need alternate transports, take a look at Beaver.

I love open source!

logstash-shipper

Sometimes the JVM is too heavy for edge collection.

Python is the least common denominator on systems. Currently I don't even HAVE a system ruby installed on my production systems. The only ruby we have is provided by omnibus for Chef.

This is a work-in-progress of a fairly lightweight shipper for logstash.

I started writing my own. Since my python-fu is 2 years old and weak, I went searching for a refresher on handling file rotation. I ended up finding a nice LogWatch example that handled it already.

I took it and added the first steps to make it a logstash-shipper.

How it works

I still need to throw in the option parsing but current it reads a directory for files ended in .log. As the files are written, it converts the log line to a subset of logstash's json_event format, and ships it over zeromq.

This means it only works with logstash HEAD right now.

Help output

usage: logstash-shipper.py [-h] -a ADDRESS [-m {bind,connect}] -p PATH

Logstash logfile shipper

optional arguments:
  -h, --help            show this help message and exit
  -a ADDRESS, --address ADDRESS
                        0mq address
  -m {bind,connect}, --mode {bind,connect}
                        bind or connect mode
  -p PATH, --path PATH  path to log files

    Logstash shipper provides an lightweight method for shipping local
    log files to Logstash.
    It does this using zeromq as the transport. This means you'll need
    a zeromq input somewhere down the road to get the events.

    Events are sent in logstash's json_event format.

    Examples 1: Listening on port 5556 (all interfaces)
        cli: logstash-shipper -a tcp://*:5556 -m bind -p /var/log/
        logstash config:
            input { zeromq {
                type => 'shipper-input'
                mode => 'client'
                topology => 'pushpull'
                address => 'tcp://shipperhost:5556'
              } }
            output { stdout { debug => true } }

    Example 2: Connecting to remote port 5556 on indexer
        cli: logstash-shipper -a tcp://indexer:5556 -m connect -p /var/log/
        logstash config:
            input { zeromq {
                type => 'shipper-input'
                mode => 'server'
                topology => 'pushpull'
                address => 'tcp://*:5556'
              }}
            output { stdout { debug => true } }

TODO

Things needing done:

  • convert to supporting single file OR directory of files
  • some basic tests
  • Testing on something OTHER than python 2.6/ubuntu 10.04 LTS

pyzmq

If for some reason pyzmq isn't building nicely for you, try easy_install pyzmq-static. It compiles its own version of zmq 2.1 for you (and libuuid as well).

License

The original script that did the heavy lifting was MIT so this one is as well.

logstash-shipper's People

Contributors

lusis avatar turtlebender avatar

Watchers

cloud123 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.