Defined Type: logster::job

Defined in:
modules/logster/manifests/job.pp

Overview

Define logster::job

Installs a logster cronjob.

Parameters

$parser - Logster parser class name to use. $logfile - Path to logfile to tail and report metrics about. $logster_options - Full CLI option string to pass to logster. Default: undef

This class also takes the usual time frequency parameters that the cron resource type does: $minute (defaults to */5), $hour, $weekday, $month, $monthday. These are used for scheduling how often you want logster to parse the logfile and send metrics.

NOTE: When defining job as 'absent', the package will become unmanaged and will need to be removed manually.

Parameters:

  • parser (Any)
  • logfile (Any)
  • ensure (Any) (defaults to: 'present')
  • logster_options (Any) (defaults to: undef)
  • minute (Any) (defaults to: '*/5')
  • hour (Any) (defaults to: undef)
  • weekday (Any) (defaults to: undef)
  • month (Any) (defaults to: undef)
  • monthday (Any) (defaults to: undef)


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'modules/logster/manifests/job.pp', line 17

define logster::job(
    $parser,
    $logfile,
    $ensure          = 'present',
    $logster_options = undef,
    $minute          = '*/5',
    $hour            = undef,
    $weekday         = undef,
    $month           = undef,
    $monthday        = undef,
) {

    if ($ensure == 'present') {
        require ::logster
    }

    cron { "logster-${title}":
        ensure   => $ensure,
        command  => "/usr/bin/logster ${logster_options} ${parser} ${logfile} > /dev/null 2>&1",
        user     => 'root',
        minute   => $minute,
        hour     => $hour,
        weekday  => $weekday,
        month    => $month,
        monthday => $monthday,
    }
}