Code Monkey home page Code Monkey logo

owl's Introduction

travis

OWL - Systemd journal watcher

Reads the systemd journal and matches entries based on a set of include patterns, e.g ERROR, and then filters out the matching entries based on an exclude list, e.g KNOWN SILLY ERROR.

This is intended to be used by a daemon such as monit. owl will return a non-zero exit code if the threshold of errors is met.

Configuration

Example configuration:

[global]
time=6
errorsToReport=5
alertThreshold=1

[service "kube-apiserver"]
include=: E.*

[service "kube-controller-manager"]
include=: E.*
include=: W.*
exclude=.*is forbidden:.*exceeding quota for resource memory
exclude=cat

[service "*"]
include=.*FATAL.*

This will check errors for the kube-apiserver and kube-controller-manager services in the last 6 seconds, report (print out) the last, and consider any more than 1 errors to be fatal and exit with a non 0 exit code. It will also match any log lines with the word FATAL in it.

The config file should be placed in /etc/owl/config

Pattern matching

Patterns are treated as regular expressions - see https://golang.org/pkg/regexp/ for details.

  • Include and exclude filters can match entries spanning multiple lines. For instance an Include: "E.*starts\n.*ends here" will find 2 matches in the following journal logs entries:

     : E error starts
     continues and ends here
     : E error starts
     and ends here
     something else comes up
    
  • Only the matching portion of the journal entry is returned. For instance, in the following journal entry, using Include: ": E.*" will return the whole journal entry line, while Include ": E" will only return ": E".

     : E error description
    
  • No journal entries will be matched when no includes are specified

Download

You can find the latest x86_64 binary at https://github.com/sky-uk/owl/releases.

To install in /usr/local/bin:

sudo curl -sSL -o /usr/local/bin/owl https://github.com/sky-uk/owl/releases/download/0.8.0/owl && \
sudo chmod 755 /usr/local/bin/owl

Development

Build with Docker

docker build . -t owl-build
docker run owl-build

To include your local changes and save the resulting binary locally:

docker run -v $PWD:/go/src/github.com/sky-uk/owl owl-build

Build without Docker

make test

Prerequisites:

  • Go Dep
  • libsystemd (Fedora: dnf install -y systemd-devel, Ubuntu: apt install -y libsystemd-dev)

Releasing

For contributors, release only from master branch:

docker build . -t owl-build
docker run -v $PWD:/go/src/github.com/sky-uk/owl owl-build release

or

make release

Then tag it and upload it to releases.

git tag 0.9.0 && git push --tags

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.