Select Supported Platforms

Select Supported Architectures

Select Tier

Github Name


README
Asset Definition
Release Notes
Release Assets

Sensu Bonsai Asset
Go Test
goreleaser

sensu-check-log

Table of Contents

Overview

sensu-check-log is a Sensu Check and log file analyzer plugin for
Sensu Go. The program scans a log file, checks it for matches, and sends
a special failure event to the agent events API when a match is detected.

The check itself will always return a 0 status, unless execution fails for
some reason.

The check must be configured with stdin: true so that failure events can
be formed correctly. If the check is not configured with stdin: true, then
it will fail to execute.

Files

sensu-check-log requires a log file to be analyzed -log and a state file
to track the offset for incremental log analysis -state. If the state file
provided by -state does not exist, sensu-check-log will create one for you.

Usage examples

Usage of sensu-check-log:
  -api-url string
        agent events API URL (default "http://localhost:3031/events")
  -event-status int
        event status on positive match (default 1)
  -ignore-initial-run
        suppresses alerts for any matches found on the first run of the plugin
  -log string
        path to log file (required)
  -match string
        RE2 regexp matcher expression (required)
  -max-bytes int
        max number of bytes to read (0 means unlimited)
  -procs int
        number of parallel analyzer processes (see "Additional Notes" for default)
  -state string
        state file for incremental log analysis (required)

Configuration

Asset registration

Sensu Assets are the best way to make use of this plugin. If you're not using an asset, please
consider doing so! If you're using sensuctl 5.13 with Sensu Backend 5.13 or later, you can use the
following command to add the asset:

sensuctl asset add sensu/sensu-check-log

If you're using an earlier version of sensuctl, you can find the asset on the Bonsai Asset Index.

Check definition

---
type: CheckConfig
api_version: core/v2
metadata:
  name: sensu-check-log
  namespace: default
spec:
  command: sensu-check-log -log log.json -state state.json -match critical
  stdin: true
  subscriptions:
  - system
  runtime_assets:
  - sensu/sensu-check-log

Installation from source

The preferred way of installing and deploying this plugin is to use it as an Asset. If you would
like to compile and install the plugin from source or contribute to it, download the latest version
or create an executable script from this source.

From the local path of the sensu-check-log repository:

go build

Additional notes

The default for -procs is determined by runtime.NumCPU().

NumCPU returns the number of logical CPUs usable by the current process.
The set of available CPUs is checked by querying the operating system at process startup.
Changes to operating system CPU allocation after process startup are not reflected.

Contributing

For more information about contributing to this plugin, see Contributing.

Are you sure you want to report this asset?

Please describe the reason for reporting this asset. Our moderators will be notified and will disable the asset if it is found to be inappropriate.

×

You must be signed in to report this asset.

Sign In with Github

Download

×

Either download the source code:

Download Source

Or download the asset definition: