Git Product home page Git Product logo

check_logmultiline's Introduction

check_logmultiline

A Check for Nagios or Icinga to analyze log files.

Check_logmultiline searches log files message by message. It saves its state in a state file to scan only new lines in a log file.

Features

  • Multiline log messages (detected by user defined regex pattern)
  • Multiple log files
  • Rotating log files
  • Multiple warning and critical patterns
  • Keep messages and its status for user defined duration

Prerequisites

Linux

The provides executable for Linux is a static build and has no dependencies. Thus it should run on all Linux versions.

Windows and macOS

Other builds are not fully static. You might need a more recent version of these OSs.

Run

Help:

USAGE:
    check_logmultiline [OPTIONS] --file <file>...

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -c, --criticalpattern <criticalpattern>...    Regex pattern to trigger a CRITICAL problem
    -f, --file <file>...
            Log file to analyze. Append ':<filenamepattern>' to specify rotated files.

    -k, --keepstatus <keepstatus>                 Remember WARNINGs and CRITICALs for this duration
    -l, --line <linepattern>                      Pattern to detect new lines
    -s, --statefile <statefile>                   File to save the processing state in from run to run
    -w, --warningpattern <warningpattern>...      Regex pattern to trigger a WARNING problem

Examples

Check for a specific pattern of Java stacktraces in log files:

check_logmultiline -f /var/log/someapp.log -l '^\[.*?\] [\da-f]{8} ' -c 'java\.lang\.OutOfMemoryError'

Check every line in rotating log files:

check_logmultiline -f '/var/log/someapp.log:^someapp\.\d\.log' -c 'java\.lang\.OutOfMemoryError'

Icinga 2

To use it in Icinga 2 you have to define a new command like this:

object CheckCommand "logmultiline" {
  command = [ "/opt/check_logmultiline" ]
  arguments = {
    "-f" = {
      value = "$logmultiline_file$"
      required = true
    }
    "-l" = {
      value = "$logmultiline_line$"
    }
    "-k" = {
      value = "$logmultiline_keepstatus$"
    }
    "-s" = {
      value = "$logmultiline_statefile$"
    }
    "-w" = {
      value = "$logmultiline_warningpattern$"
    }
    "-c" = {
      value = "$logmultiline_criticalpattern$"
    }
  }
}

Build

You only need Rust edition 2018 (version >= 1.31). And run:

cargo build --release

License

Licensed under either of

at your option.

This complies with the license terms of Rust and all dependencies used here.

check_logmultiline's People

Contributors

ponchofiesta avatar

Stargazers

Emmanuel GUEGAN avatar

Watchers

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.