Lightweight composition layer for Puppet TripleO
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

41 lines
1.6 KiB

  1. # This is used to look up a list of service-specific rsyslogd configurations
  2. # in the hiera data provided by THT.
  3. #
  4. # [*sources*]
  5. # (Optional) List of hashes. Contains configuration of file inputs for given service.
  6. # Defaults to hiera("tripleo_logging_sources_${title}", undef)
  7. #
  8. # [*default_startmsg*]
  9. # (Optional) String. Default POSIX ERE for start of log record. The default enables to forward
  10. # multiline tracebacks for most of OpenStack services. It can be overridden either by this
  11. # parameter for all file inputs or in each file input separately in THT parameters
  12. # tripleo_logging_sources_<service name>.
  13. # Defaults to '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.[0-9]+ [0-9]+)? (DEBUG|INFO|WARNING|ERROR) '
  14. #
  15. define tripleo::profile::base::logging::rsyslog::file_input (
  16. $sources = hiera("tripleo_logging_sources_${title}", undef),
  17. $default_startmsg = '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.[0-9]+ [0-9]+)? (DEBUG|INFO|WARNING|ERROR) '
  18. ) {
  19. if $sources {
  20. $sources_array = Array($sources, true)
  21. $rsyslog_sources = $sources_array.reduce([]) |$memo, $config| {
  22. if ! $config['startmsg.regex'] {
  23. $record = $config + {'startmsg.regex' => $default_startmsg}
  24. } else {
  25. $record = $config
  26. }
  27. $memo + [$record]
  28. }
  29. $rsyslog_sources.each |$config| {
  30. rsyslog::component::input{ "${title}_${config['tag']}":
  31. priority => $::rsyslog::input_priority,
  32. target => $::rsyslog::target_file,
  33. confdir => $::rsyslog::confdir,
  34. type => 'imfile',
  35. config => $config
  36. }
  37. }
  38. }
  39. }