Defined Type: logstash::output::elasticsearch

Defined in:
modules/logstash/manifests/output/elasticsearch.pp

Overview

Define: logstash::output::elasticsearch

Configure logstash to output to elasticsearch

Parameters:

  • $ensure: Whether the config should exist. Default present.

  • $host: Elasticsearch server. Default '127.0.0.1'.

  • $index: Index to write events to. Default '$title-%+YYYY+YYYY.MM+YYYY.MM.dd'.

  • $port: Elasticsearch server port. Default 9200.

  • $guard_condition: Logstash condition to require to pass events to output.

    Default undef.
    
  • $priority: Configuration loading priority. Default 10.

  • $template: Path to Elasticsearch mapping template. Default undef.

  • $template_name: Name of Elasticsearch mapping template.

    Default $title.
    
  • $document_type: Set the elasticsearch document type to write events to. Default undef.

  • $plugin_id: Name associated with Logstash metrics

Sample usage:

logstash::output::elasticsearch { 'logstash':
    host            => '127.0.0.1',
    guard_condition => '"es" in [tags]',
    manage_indices  => true,
}

Parameters:

  • ensure (Wmflib::Ensure) (defaults to: present)
  • host (Variant[Stdlib::IP::Address, Stdlib::Fqdn]) (defaults to: '127.0.0.1')
  • index (String) (defaults to: "${title}-%{+YYYY.MM.dd}")
  • port (Integer) (defaults to: 9200)
  • guard_condition (Optional[String]) (defaults to: undef)
  • priority (Integer) (defaults to: 10)
  • template (Optional[String]) (defaults to: undef)
  • template_name (String) (defaults to: $title)
  • document_type (Optional[String]) (defaults to: undef)
  • plugin_id (String) (defaults to: "output/elasticsearch/${title}")


27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'modules/logstash/manifests/output/elasticsearch.pp', line 27

define logstash::output::elasticsearch(
    Wmflib::Ensure                             $ensure           = present,
    Variant[Stdlib::IP::Address, Stdlib::Fqdn] $host             = '127.0.0.1',
    String                                     $index            = "${title}-%{+YYYY.MM.dd}",
    Integer                                    $port             = 9200,
    Optional[String]                           $guard_condition  = undef,
    Integer                                    $priority         = 10,
    Optional[String]                           $template         = undef,
    String                                     $template_name    = $title,
    Optional[String]                           $document_type    = undef,
    String                                     $plugin_id        = "output/elasticsearch/${title}",
) {
    logstash::conf{ "output-elasticsearch-${title}":
        ensure   => $ensure,
        content  => template('logstash/output/elasticsearch.erb'),
        priority => $priority,
    }
}