Code Monkey home page Code Monkey logo

journal2gelf's Introduction

journal2gelf

Export structured log records from the systemd journal and send them to a Graylog2 server as GELF messages.

Tested on Python 2.7 and Fedora 17 (systemd-44-17) and Fedora 19 (systemd-204).

journalctl output format change

Starting with systemd-190 journalctl switched to an easier to parse single-line JSON format. This is now the default expected format as of journal2gelf v0.0.3.

For versions of systemd < 190, you must add the -m switch.

Run journalctl --version to get the systemd version.

Dependencies:

  • graypy

Install

On Fedora 17+ (or other systems with a version of systemd that includes journal support):

sudo apt install git python-pip
pip install git+http://github.com/csawyerYumaed/journal2gelf.git#egg=journal2gelf

Running as a service

Copy and edit the included examples/journal2gelf.service to /etc/systemd/system.

cd /etc/systemd/system; wget https://github.com/csawyerYumaed/journal2gelf/raw/master/examples/journal2gelf.service
systemctl daemon-reload
systemctl enable journal2gelf.service
systemctl start journal2gelf.service

Usage:

By default, journal2gelf will look for input on stdin. eg:

  • Send all logs and exit:

    journalctl -o json | journal2gelf

The -t flag can be specified and journal2gelf will automatically start journalctl in tail mode. This makes it easier to run as a systemd service.

journal2gelf -t

This is equivalent to running:

journalctl -o json -f | journal2gelf

Graylog2 server and port can be specified with -s and -p flags.

License

Copyright 2012 Joe Miller https://github.com/joemiller

Released under the MIT license, see LICENSE for details.

journal2gelf's People

Contributors

csawyeryumaed avatar joemiller avatar nstielau avatar

Watchers

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