Puppet Class: simp_logstash::output::file

Defined in:
manifests/output/file.pp

Overview

A Logstash output to a file on the system

Though this class has a great deal repeated with the other output classes, they remain separate in the event that variables need to be added in the future for ERB processing.

Parameters:

  • path (Absolute_Path) (defaults to: '/var/log/logstash/file_output.log')

    The destination for the file output.

  • codec (String) (defaults to: '')
  • create_if_deleted (Boolean) (defaults to: '')

    Create the target file if necessary.

  • dir_mode (Integer) (defaults to: '')

    The mode for created directories.

  • file_mode (Integer) (defaults to: '')

    The mode for created files.

  • filename_failure (String) (defaults to: '')

    If the generated path is invalid, save output to this filename instead.

  • flush_interval (Integer) (defaults to: '')

    Seconds in which to flush to log files.

  • gzip (Boolean) (defaults to: '')

    Gzip the output stream before writing to disk.

  • workers (Integer) (defaults to: '')

    The number of workers to use for this output.

Author:

  • Trevor Vaughan <tvaughan@onyxpoint.com>



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'manifests/output/file.pp', line 30

class simp_logstash::output::file (
  $path              = '/var/log/logstash/file_output.log',
  $codec             = '',
  $create_if_deleted = '',
  $dir_mode          = '',
  $file_mode         = '',
  $filename_failure  = '',
  $flush_interval    = '',
  $gzip              = '',
  $workers           = ''
) {
  validate_absolute_path($path)
  validate_string($codec)
  if !empty($create_if_deleted) { validate_bool($create_if_deleted) }
  if !empty($dir_mode) { validate_integer($dir_mode) }
  if !empty($file_mode) { validate_integer($file_mode) }
  validate_string($filename_failure)
  if !empty($flush_interval) { validate_integer($flush_interval) }
  if !empty($gzip) { validate_bool($gzip) }
  if !empty($workers) { validate_integer($workers) }

  ### Common material to all outputs
  include '::simp_logstash'

  $_component_name = 'file'
  $_group = 'output'
  $_group_order = $::simp_logstash::config_order[$_group]

  if empty($content) {
    $_content = template("${module_name}/${_group}/${_component_name}.erb")
  }
  else {
    $_content = $content
  }

  file { "${::simp_logstash::config_prefix}-${_group_order}_${_group}-${_group_order}-${_component_name}${::simp_logstash::config_suffix}":
    ensure  => 'file',
    owner   => 'root',
    group   => $::logstash::logstash_group,
    mode    => '0640',
    content => $_content,
    notify  => Class['logstash::service']
  }
  ### End common material
}