├── .editorconfig ├── .fixtures.yml ├── .github ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE.md ├── PULL_REQUEST_TEMPLATE.md ├── labeler.yml ├── release.yml └── workflows │ ├── ci.yml │ ├── labeler.yml │ ├── prepare_release.yml │ └── release.yml ├── .gitignore ├── .msync.yml ├── .overcommit.yml ├── .pmtignore ├── .puppet-lint.rc ├── .rubocop.yml ├── .sync.yml ├── CHANGELOG.md ├── CONTRIBUTORS.md ├── Gemfile ├── HISTORY.md ├── LICENSE ├── README.md ├── REFERENCE.md ├── Rakefile ├── data └── common.yaml ├── hiera.yaml ├── manifests ├── base.pp ├── component │ ├── action.pp │ ├── custom_config.pp │ ├── expression_filter.pp │ ├── global_config.pp │ ├── input.pp │ ├── legacy_config.pp │ ├── lookup_table.pp │ ├── main_queue.pp │ ├── module.pp │ ├── parser.pp │ ├── property_filter.pp │ ├── ruleset.pp │ └── template.pp ├── config.pp ├── config │ ├── actions.pp │ ├── custom.pp │ ├── expression_filters.pp │ ├── global.pp │ ├── inputs.pp │ ├── legacy.pp │ ├── lookup_tables.pp │ ├── main_queue.pp │ ├── modules.pp │ ├── parsers.pp │ ├── property_filters.pp │ ├── rulesets.pp │ └── templates.pp ├── generate_concat.pp └── init.pp ├── metadata.json ├── spec ├── acceptance │ ├── actions_spec.rb │ ├── base_spec.rb │ ├── expression_filter_spec.rb │ ├── inputs_spec.rb │ ├── rsyslog_spec.rb │ └── ruleset_spec.rb ├── classes │ ├── config_spec.rb │ └── init_spec.rb ├── defines │ ├── component │ │ ├── action_spec.rb │ │ ├── expression_filter_spec.rb │ │ ├── global_config_spec.rb │ │ ├── input_spec.rb │ │ ├── legacy_config_spec.rb │ │ ├── lookup_table_spec.rb │ │ ├── main_queue_spec.rb │ │ ├── module_spec.rb │ │ ├── parser_spec.rb │ │ ├── property_filter_spec.rb │ │ ├── ruleset_spec.rb │ │ └── template_spec.rb │ └── generate_concat_spec.rb ├── fixtures │ └── test_files │ │ ├── example_lookup.json │ │ └── lookup_table.conf ├── setup_acceptance_node.pp ├── spec_helper.rb ├── spec_helper_acceptance.rb └── type_aliases │ ├── actions │ └── outputs │ │ ├── omamqp1_spec.rb │ │ ├── omelasticsearch_spec.rb │ │ ├── omfile_spec.rb │ │ ├── omfwd_spec.rb │ │ ├── omhiredis_spec.rb │ │ ├── omhttpfs_spec.rb │ │ ├── omjoural_spec.rb │ │ ├── omkafka_spec.rb │ │ ├── omlibdbi_spec.rb │ │ ├── ommail_spec.rb │ │ ├── ommongodb_spec.rb │ │ ├── ommysql_spec.rb │ │ ├── ompgsql_spec.rb │ │ ├── ompipe_spec.rb │ │ ├── omprog_spec.rb │ │ ├── omrelp_spec.rb │ │ ├── omsnmp_spec.rb │ │ ├── omudpspoof_spec.rb │ │ └── omusrmsg_spec.rb │ ├── actions_spec.rb │ ├── inputs │ ├── imbatchreports_spec.rb │ ├── imfile_spec.rb │ ├── imgssapi_spec.rb │ ├── imkafka_spec.rb │ ├── improg_spec.rb │ ├── imptcp_spec.rb │ ├── imrelp_spec.rb │ ├── imtcp_spec.rb │ ├── imtuxedoulog_spec.rb │ ├── imudp_spec.rb │ └── imuxsock_spec.rb │ └── modules │ └── inputs │ ├── imdocker_spec.rb │ ├── imfile_spec.rb │ └── imjournal_spec.rb ├── templates ├── action.epp ├── call.epp ├── exec.epp ├── expression_filter.epp ├── generic.epp ├── global_config.epp ├── input.epp ├── legacy_config.epp ├── lookup.epp ├── lookup_table.epp ├── modules.epp ├── parser.epp ├── property_filter.epp ├── ruleset.epp ├── set.epp ├── tasks.epp └── template.epp └── types ├── actions.pp ├── actions ├── outputs │ ├── omamqp1.pp │ ├── omelasticsearch.pp │ ├── omfile.pp │ ├── omfwd.pp │ ├── omhiredis.pp │ ├── omhttpfs.pp │ ├── omjournal.pp │ ├── omkafka.pp │ ├── omlibdbi.pp │ ├── ommail.pp │ ├── ommongodb.pp │ ├── ommysql.pp │ ├── ompgsql.pp │ ├── ompipe.pp │ ├── omprog.pp │ ├── omrelp.pp │ ├── omsnmp.pp │ ├── omudpspoof.pp │ └── omusrmsg.pp └── parameters.pp ├── inputs ├── imbatchreports.pp ├── imfile.pp ├── imgssapi.pp ├── imkafka.pp ├── improg.pp ├── imptcp.pp ├── imrelp.pp ├── imtcp.pp ├── imtuxedoulog.pp ├── imudp.pp └── imuxsock.pp ├── modules ├── input.pp ├── inputs │ ├── imdocker.pp │ ├── imfile.pp │ └── imjournal.pp ├── message.pp ├── output.pp ├── parser.pp └── string.pp ├── propertyoperator.pp ├── queue └── parameters.pp └── syslog └── severity.pp /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | 3 | # Managed by modulesync - DO NOT EDIT 4 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 5 | 6 | root = true 7 | 8 | [*] 9 | charset = utf-8 10 | end_of_line = lf 11 | indent_size = 2 12 | tab_width = 2 13 | indent_style = space 14 | insert_final_newline = true 15 | trim_trailing_whitespace = true 16 | -------------------------------------------------------------------------------- /.fixtures.yml: -------------------------------------------------------------------------------- 1 | --- 2 | fixtures: 3 | repositories: 4 | concat: 'https://github.com/puppetlabs/puppetlabs-concat.git' 5 | stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib.git' 6 | apt: 'https://github.com/puppetlabs/puppetlabs-apt.git' 7 | yumrepo_core: 8 | repo: https://github.com/puppetlabs/puppetlabs-yumrepo_core.git 9 | puppet_version: ">= 6.0.0" 10 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 10 | 11 | ## Affected Puppet, Ruby, OS and module versions/distributions 12 | 13 | - Puppet: 14 | - Ruby: 15 | - Distribution: 16 | - Module version: 17 | 18 | ## How to reproduce (e.g Puppet code you use) 19 | 20 | ## What are you seeing 21 | 22 | ## What behaviour did you expect instead 23 | 24 | ## Output log 25 | 26 | ## Any additional information you'd like to impart 27 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 9 | #### Pull Request (PR) description 10 | 13 | 14 | #### This Pull Request (PR) fixes the following issues 15 | 21 | -------------------------------------------------------------------------------- /.github/labeler.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Managed by modulesync - DO NOT EDIT 3 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 4 | 5 | skip-changelog: 6 | - head-branch: ['^release-*', 'release'] 7 | -------------------------------------------------------------------------------- /.github/release.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Managed by modulesync - DO NOT EDIT 3 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 4 | 5 | # https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes 6 | 7 | changelog: 8 | exclude: 9 | labels: 10 | - duplicate 11 | - invalid 12 | - modulesync 13 | - question 14 | - skip-changelog 15 | - wont-fix 16 | - wontfix 17 | 18 | categories: 19 | - title: Breaking Changes 🛠 20 | labels: 21 | - backwards-incompatible 22 | 23 | - title: New Features 🎉 24 | labels: 25 | - enhancement 26 | 27 | - title: Bug Fixes 🐛 28 | labels: 29 | - bug 30 | 31 | - title: Documentation Updates 📚 32 | labels: 33 | - documentation 34 | - docs 35 | 36 | - title: Dependency Updates ⬆️ 37 | labels: 38 | - dependencies 39 | 40 | - title: Other Changes 41 | labels: 42 | - "*" 43 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Managed by modulesync - DO NOT EDIT 3 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 4 | 5 | name: CI 6 | 7 | # yamllint disable-line rule:truthy 8 | on: 9 | pull_request: {} 10 | push: 11 | branches: 12 | - main 13 | - master 14 | 15 | concurrency: 16 | group: ${{ github.ref_name }} 17 | cancel-in-progress: true 18 | 19 | jobs: 20 | puppet: 21 | name: Puppet 22 | uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v3 23 | -------------------------------------------------------------------------------- /.github/workflows/labeler.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Managed by modulesync - DO NOT EDIT 3 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 4 | 5 | name: "Pull Request Labeler" 6 | 7 | # yamllint disable-line rule:truthy 8 | on: 9 | pull_request_target: {} 10 | 11 | jobs: 12 | labeler: 13 | permissions: 14 | contents: read 15 | pull-requests: write 16 | runs-on: ubuntu-latest 17 | steps: 18 | - uses: actions/labeler@v5 19 | -------------------------------------------------------------------------------- /.github/workflows/prepare_release.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Managed by modulesync - DO NOT EDIT 3 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 4 | 5 | name: 'Prepare Release' 6 | 7 | on: 8 | workflow_dispatch: 9 | inputs: 10 | version: 11 | description: 'Module version to be released. Must be a valid semver string without leading v. (1.2.3)' 12 | required: false 13 | 14 | jobs: 15 | release_prep: 16 | uses: 'voxpupuli/gha-puppet/.github/workflows/prepare_release.yml@v3' 17 | with: 18 | version: ${{ github.event.inputs.version }} 19 | allowed_owner: 'voxpupuli' 20 | secrets: 21 | # Configure secrets here: 22 | # https://docs.github.com/en/actions/security-guides/encrypted-secrets 23 | github_pat: '${{ secrets.PCCI_PAT_RELEASE_PREP }}' 24 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Managed by modulesync - DO NOT EDIT 3 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 4 | 5 | name: Release 6 | 7 | # yamllint disable-line rule:truthy 8 | on: 9 | push: 10 | tags: 11 | - '*' 12 | 13 | jobs: 14 | release: 15 | name: Release 16 | uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v3 17 | with: 18 | allowed_owner: 'voxpupuli' 19 | secrets: 20 | # Configure secrets here: 21 | # https://docs.github.com/en/actions/security-guides/encrypted-secrets 22 | username: ${{ secrets.PUPPET_FORGE_USERNAME }} 23 | api_key: ${{ secrets.PUPPET_FORGE_API_KEY }} 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Managed by modulesync - DO NOT EDIT 2 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 3 | 4 | /pkg/ 5 | /Gemfile.lock 6 | /Gemfile.local 7 | /vendor/ 8 | /.vendor/ 9 | /spec/fixtures/manifests/ 10 | /spec/fixtures/modules/ 11 | /.vagrant/ 12 | /.bundle/ 13 | /.ruby-version 14 | /coverage/ 15 | /log/ 16 | /.idea/ 17 | /.dependencies/ 18 | /.librarian/ 19 | /Puppetfile.lock 20 | *.iml 21 | .*.sw? 22 | /.yardoc/ 23 | /Guardfile 24 | bolt-debug.log 25 | .rerun.json 26 | -------------------------------------------------------------------------------- /.msync.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Managed by modulesync - DO NOT EDIT 3 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 4 | 5 | modulesync_config_version: '9.7.0' 6 | -------------------------------------------------------------------------------- /.overcommit.yml: -------------------------------------------------------------------------------- 1 | # Managed by modulesync - DO NOT EDIT 2 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 3 | # 4 | # Hooks are only enabled if you take action. 5 | # 6 | # To enable the hooks run: 7 | # 8 | # ``` 9 | # bundle exec overcommit --install 10 | # # ensure .overcommit.yml does not harm to you and then 11 | # bundle exec overcommit --sign 12 | # ``` 13 | # 14 | # (it will manage the .git/hooks directory): 15 | # 16 | # Examples howto skip a test for a commit or push: 17 | # 18 | # ``` 19 | # SKIP=RuboCop git commit 20 | # SKIP=PuppetLint git commit 21 | # SKIP=RakeTask git push 22 | # ``` 23 | # 24 | # Don't invoke overcommit at all: 25 | # 26 | # ``` 27 | # OVERCOMMIT_DISABLE=1 git commit 28 | # ``` 29 | # 30 | # Read more about overcommit: https://github.com/brigade/overcommit 31 | # 32 | # To manage this config yourself in your module add 33 | # 34 | # ``` 35 | # .overcommit.yml: 36 | # unmanaged: true 37 | # ``` 38 | # 39 | # to your modules .sync.yml config 40 | --- 41 | PreCommit: 42 | RuboCop: 43 | enabled: true 44 | description: 'Runs rubocop on modified files only' 45 | command: ['bundle', 'exec', 'rubocop'] 46 | RakeTarget: 47 | enabled: true 48 | description: 'Runs lint on modified files only' 49 | targets: 50 | - 'lint' 51 | command: ['bundle', 'exec', 'rake'] 52 | YamlSyntax: 53 | enabled: true 54 | JsonSyntax: 55 | enabled: true 56 | TrailingWhitespace: 57 | enabled: true 58 | 59 | PrePush: 60 | RakeTarget: 61 | enabled: true 62 | description: 'Run rake targets' 63 | targets: 64 | - 'validate' 65 | - 'test' 66 | - 'rubocop' 67 | command: ['bundle', 'exec', 'rake'] 68 | -------------------------------------------------------------------------------- /.pmtignore: -------------------------------------------------------------------------------- 1 | # Managed by modulesync - DO NOT EDIT 2 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 3 | 4 | /docs/ 5 | /pkg/ 6 | /Gemfile 7 | /Gemfile.lock 8 | /Gemfile.local 9 | /vendor/ 10 | /.vendor/ 11 | /spec/ 12 | /Rakefile 13 | /.vagrant/ 14 | /.bundle/ 15 | /.ruby-version 16 | /coverage/ 17 | /log/ 18 | /.idea/ 19 | /.dependencies/ 20 | /.github/ 21 | /.librarian/ 22 | /Puppetfile.lock 23 | /Puppetfile 24 | *.iml 25 | /.editorconfig 26 | /.fixtures.yml 27 | /.gitignore 28 | /.msync.yml 29 | /.overcommit.yml 30 | /.pmtignore 31 | /.rspec 32 | /.rspec_parallel 33 | /.rubocop.yml 34 | /.sync.yml 35 | .*.sw? 36 | /.yardoc/ 37 | /.yardopts 38 | /Dockerfile 39 | /HISTORY.md 40 | -------------------------------------------------------------------------------- /.puppet-lint.rc: -------------------------------------------------------------------------------- 1 | # Managed by modulesync - DO NOT EDIT 2 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 3 | 4 | --fail-on-warnings 5 | --no-parameter_documentation-check 6 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Managed by modulesync - DO NOT EDIT 3 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 4 | 5 | inherit_gem: 6 | voxpupuli-test: rubocop.yml 7 | -------------------------------------------------------------------------------- /.sync.yml: -------------------------------------------------------------------------------- 1 | --- 2 | .puppet-lint.rc: 3 | enabled_lint_checks: 4 | - parameter_types 5 | -------------------------------------------------------------------------------- /CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | # Readme for Contributors 2 | 3 | ## Module Overview 4 | This is a rsyslog module which uses the concept of default hiera data in a 5 | puppet module, the aim of the module is to abstract rsyslog configuration as 6 | much as possible into simple yaml configuration. The module is broken down 7 | granularly to provide any custom configuration required. 8 | 9 | ## Module Layout 10 | The module is written as 2 main components one is is installing the package, 11 | configuring the service etc.., with base install and the second is configuring 12 | it based on the configuration data provided. The configuration 13 | class is broken down into 8 classes 14 | 15 | ``` 16 | * rsyslog::config::modules 17 | * rsyslog::config::global 18 | * rsyslog::config::main_queue 19 | * rsyslog::config::templates 20 | * rsyslog::config::actions 21 | * rsyslog::config::inputs 22 | * rsyslog::config::custom 23 | * rsyslog::config::legacy 24 | ``` 25 | 26 | Each of the above classes accepts either an Array or Hash as its input. There 27 | are parts of configuration in rsyslog where having simple hash won't suit for 28 | complex configuration. To facilitate that, few of the above mentioned classes 29 | accepts hash of hashes as its input and loops through that hash and passes 30 | the broken down small hash as the input to the specific component written for 31 | that class. The component/definition creates content by passing the hash values 32 | to epp template. The class uses concat module, config priority, target file 33 | assigned for that class and creates small snippets of configuration which is 34 | joined together in the end by the concat module. 35 | 36 | ## Example 37 | The below example shows what happens when `include rsyslog::config::global` class 38 | is called with the hiera data provided below. The class breaks down the hash 39 | and pass small set of hashes to the definition and creates the configuration shown 40 | below. For full list 41 | 42 | ##### Hiera Data 43 | ``` 44 | #common configuration 45 | rsyslog::global_config_priority: 20 46 | rsyslog::target_file: 50_rsyslog.conf 47 | rsyslog::confdir: /etc/rsyslog.d 48 | 49 | #configuration data for global_config class 50 | rsyslog::config::global_config: 51 | parser.SomeConfigurationOption: 52 | value: 'on' 53 | EscapeControlCharactersOnReceive: 54 | value: 'off' 55 | type: legacy 56 | ``` 57 | 58 | ##### Global Config Class 59 | ``` 60 | #This class loops through the hash of hashes and passes 61 | #small hashes to the component as input 62 | 63 | class rsyslog::config::global { 64 | $rsyslog::config::global_config.each |$param, $config| { 65 | rsyslog::component::global_config { $param: 66 | * => { 67 | 'priority' => $rsyslog::global_config_priority, 68 | 'target' => $rsyslog::target_file, 69 | } + $config, 70 | } 71 | } 72 | } 73 | ``` 74 | 75 | ##### Custom Definition/Component 76 | ``` 77 | #All this define does send the hash values to epp 78 | #template and gets content returned by the template 79 | 80 | define rsyslog::component::global_config ( 81 | Integer $priority, 82 | String $target, 83 | String $value, 84 | Optional[String] $type = 'rainerscript', 85 | Optional[String] $format = '<%= $content %>' 86 | ) { 87 | 88 | include rsyslog 89 | 90 | $content = epp('rsyslog/global_config.epp', { 91 | 'config_item' => $name, 92 | 'type' => $type, 93 | 'value' => $value 94 | }) 95 | 96 | concat::fragment {"rsyslog::component::global_config::${name}": 97 | target => "${::rsyslog::confdir}/${target}", 98 | content => inline_epp($format), 99 | order => $priority, 100 | } 101 | 102 | } 103 | ``` 104 | 105 | ##### EPP Template 106 | ``` 107 | #This template will return predefined content 108 | #interpretting the values provided by component 109 | 110 | <%- | 111 | String $value, 112 | String $config_item, 113 | Optional[String] $type 114 | | -%> 115 | <% if $type == 'legacy' { -%> 116 | $<%= $config_item %> <%= $value %> 117 | <% } else { -%> 118 | global ( 119 | <%= $config_item %>="<%= $value %>" 120 | ) 121 | <% } -%> 122 | ``` 123 | 124 | ##### Configuration Output 125 | ``` 126 | #The configuration output will be on multiple small files initially and 127 | #will be joined together by the concat module as they will have same priority 128 | 129 | #snippet1-priority20 130 | global ( 131 | parser.SomeConfigurationOption="on" 132 | ) 133 | 134 | #snippet2-prirority20 135 | $EscapeControlCharactersOnReceive off 136 | ``` 137 | Similarly each of the config classes provide a piece of functionality. 138 | For full details on which class provides what functionally in configuring 139 | rsyslog please see the [README.md](../master/README.md) file. 140 | 141 | ## Extending Module 142 | The module provides full flexibility for custom configuration / extension, 143 | it can be easily extended to include any specific functionally by assigning 144 | a priority for the class where the new functionality to be placed in the 145 | 50_rsyslog.conf file or it can also be dropped as a separate file into 146 | /etc/rsyslog.d directory. The class/component/template structure shoule 147 | be maintained as above to keep the code consistent. 148 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # Managed by modulesync - DO NOT EDIT 2 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 3 | 4 | source ENV['GEM_SOURCE'] || 'https://rubygems.org' 5 | 6 | group :test do 7 | gem 'voxpupuli-test', '~> 10.0', :require => false 8 | gem 'puppet_metadata', '~> 5.0', :require => false 9 | end 10 | 11 | group :development do 12 | gem 'guard-rake', :require => false 13 | gem 'overcommit', '>= 0.39.1', :require => false 14 | end 15 | 16 | group :system_tests do 17 | gem 'voxpupuli-acceptance', '~> 3.5', :require => false 18 | end 19 | 20 | group :release do 21 | gem 'voxpupuli-release', '~> 3.0', :require => false 22 | end 23 | 24 | gem 'rake', :require => false 25 | gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] 26 | 27 | puppetversion = ENV['PUPPET_GEM_VERSION'] || [">= 7.24", "< 9"] 28 | gem 'puppet', puppetversion, :require => false, :groups => [:test] 29 | 30 | # vim: syntax=ruby 31 | -------------------------------------------------------------------------------- /HISTORY.md: -------------------------------------------------------------------------------- 1 | ## 1.1.0 (2017-10-17) 2 | 3 | * Feature: Added an `external_service` boolean parameter for allowing puppet-rsyslog to manage configs/logs shared with other processes that may be managed by other modules. (https://github.com/crayfishx/puppet-rsyslog/pull/28) 4 | 5 | # 1.0.0 6 | 7 | This release contains many new enhancements and features, and brings the module to a 1.0.0 release. Many thanks to @dhollinger for the many contributions to this release. 8 | 9 | * Enhancement: [Added flag to enable/disable service management](https://github.com/crayfishx/puppet-rsyslog/issues/17) 10 | * Enhancement: [Add custom config dirs and target files](https://github.com/crayfishx/puppet-rsyslog/issues/19) 11 | * Feature: [Rsyslog 8.x lookup table support](s://github.com/crayfishx/puppet-rsyslog/issues/15) 12 | * Feature: [Support for the rsyslog parser() function](https://github.com/crayfishx/puppet-rsyslog/issues/21) 13 | * Feature: [Support for multi ruleset generation](https://github.com/crayfishx/puppet-rsyslog/issues/22) 14 | * Feature: [Support for ruleset stops](https://github.com/crayfishx/puppet-rsyslog/pull/26) 15 | * Bugfix: [Solve the lack of errors when a component concat::fragment doesn't generate content due to a missing parent concat resource](https://github.com/crayfishx/puppet-rsyslog/issues/19) 16 | 17 | 18 | ### 0.2.0 19 | 20 | * [Fixed variable scoping styling and rake validation fixes](https://github.com/crayfishx/puppet-rsyslog/pull/2) 21 | * [Support for legacy options](https://github.com/crayfishx/puppet-rsyslog/pull/4) 22 | * [README fixes](https://github.com/crayfishx/puppet-rsyslog/pull/5) 23 | * [Option support for modules](https://github.com/crayfishx/puppet-rsyslog/pull/6) 24 | * [Updated the action component to support logger facility](9) 25 | * [Added more tests for the legacy_config / main_queue class](https://github.com/crayfishx/puppet-rsyslog/pull/10) 26 | * [Documentation Updates](https://github.com/crayfishx/puppet-rsyslog/pull/12) 27 | * [Fixed the global params config styling](https://github.com/crayfishx/puppet-rsyslog/pull/13) 28 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Managed by modulesync - DO NOT EDIT 2 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 3 | 4 | # Attempt to load voxpupuli-test (which pulls in puppetlabs_spec_helper), 5 | # otherwise attempt to load it directly. 6 | begin 7 | require 'voxpupuli/test/rake' 8 | rescue LoadError 9 | begin 10 | require 'puppetlabs_spec_helper/rake_tasks' 11 | rescue LoadError 12 | end 13 | end 14 | 15 | # load optional tasks for acceptance 16 | # only available if gem group releases is installed 17 | begin 18 | require 'voxpupuli/acceptance/rake' 19 | rescue LoadError 20 | end 21 | 22 | # load optional tasks for releases 23 | # only available if gem group releases is installed 24 | begin 25 | require 'voxpupuli/release/rake_tasks' 26 | rescue LoadError 27 | # voxpupuli-release not present 28 | else 29 | GCGConfig.user = 'voxpupuli' 30 | GCGConfig.project = 'puppet-rsyslog' 31 | end 32 | 33 | desc "Run main 'test' task and report merged results to coveralls" 34 | task test_with_coveralls: [:test] do 35 | if Dir.exist?(File.expand_path('../lib', __FILE__)) 36 | require 'coveralls/rake/task' 37 | Coveralls::RakeTask.new 38 | Rake::Task['coveralls:push'].invoke 39 | else 40 | puts 'Skipping reporting to coveralls. Module has no lib dir' 41 | end 42 | end 43 | 44 | # vim: syntax=ruby 45 | -------------------------------------------------------------------------------- /data/common.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | rsyslog::confdir: /etc/rsyslog.d 3 | rsyslog::package_name: rsyslog 4 | rsyslog::package_version: installed 5 | rsyslog::manage_package: true 6 | rsyslog::manage_confdir: true 7 | rsyslog::purge_config_files: true 8 | rsyslog::override_default_config: true 9 | rsyslog::config_file: /etc/rsyslog.conf 10 | rsyslog::manage_service: true 11 | rsyslog::service_name: rsyslog 12 | rsyslog::service_status: running 13 | rsyslog::service_enabled: true 14 | rsyslog::external_service: false 15 | rsyslog::use_upstream_repo: false 16 | 17 | ## This can be an array of extra "feature" packages to install for rsyslog 18 | rsyslog::feature_packages: [] 19 | 20 | ## Default object type priorities (can be overridden) 21 | rsyslog::global_config_priority: 10 22 | rsyslog::module_load_priority: 20 23 | rsyslog::input_priority: 30 24 | rsyslog::main_queue_priority: 40 25 | rsyslog::parser_priority: 45 26 | rsyslog::template_priority: 50 27 | rsyslog::filter_priority: 55 28 | rsyslog::action_priority: 60 29 | rsyslog::ruleset_priority: 65 30 | rsyslog::lookup_table_priority: 70 31 | rsyslog::legacy_config_priority: 80 32 | rsyslog::custom_priority: 90 33 | rsyslog::target_file: 50_rsyslog.conf 34 | -------------------------------------------------------------------------------- /hiera.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | version: 5 3 | 4 | defaults: 5 | datadir: data 6 | data_hash: yaml_data 7 | 8 | hierarchy: 9 | - name: "Common Data" 10 | path: "common.yaml" 11 | -------------------------------------------------------------------------------- /manifests/base.pp: -------------------------------------------------------------------------------- 1 | # @summary This class manages the base installation for rsyslog 2 | class rsyslog::base { 3 | if $rsyslog::use_upstream_repo { 4 | case $facts['os']['family'] { 5 | 'Debian': { 6 | if $facts['os']['name'] == 'Ubuntu' { 7 | include apt 8 | apt::ppa { 'ppa:adiscon/v8-stable': } 9 | } 10 | } 11 | 'RedHat': { 12 | yumrepo { 'upstream_rsyslog': 13 | ensure => 'present', 14 | descr => 'Adiscon Enterprise Linux rsyslog', 15 | baseurl => 'http://rpms.adiscon.com/v8-stable/epel-$releasever/$basearch', 16 | enabled => '1', 17 | gpgcheck => '0', 18 | gpgkey => 'http://rpms.adiscon.com/v8-stable/epel-$releasever/$basearch', 19 | } 20 | } 21 | default: { fail("${facts['os']['name']} is not currently supported by upstream packages.") } 22 | } 23 | } 24 | 25 | if $rsyslog::manage_package { 26 | package { $rsyslog::package_name: 27 | ensure => $rsyslog::package_version, 28 | } 29 | } 30 | 31 | if $rsyslog::feature_packages { 32 | package { $rsyslog::feature_packages: 33 | ensure => installed, 34 | require => Package[$rsyslog::package_name], 35 | } 36 | } 37 | 38 | if $rsyslog::manage_confdir { 39 | file { $rsyslog::confdir: 40 | ensure => directory, 41 | owner => 'root', 42 | group => 'root', 43 | mode => $rsyslog::confdir_permissions, 44 | purge => $rsyslog::purge_config_files, 45 | recurse => $rsyslog::purge_config_files, 46 | } 47 | 48 | if $rsyslog::manage_package { 49 | Package[$rsyslog::package_name] -> File[$rsyslog::confdir] 50 | } 51 | } 52 | 53 | if $rsyslog::override_default_config { 54 | $message = @(EOT) 55 | # This file is managed by Puppet. No configuration is placed here 56 | # all configuration is under the rsyslog.d directory 57 | |EOT 58 | 59 | file { $rsyslog::config_file: 60 | ensure => file, 61 | content => "${message}\n${rsyslog::config_file_include}\n", 62 | mode => $rsyslog::global_conf_perms, 63 | } 64 | 65 | if $rsyslog::manage_service { 66 | File[$rsyslog::config_file] ~> Service[$rsyslog::service_name] 67 | } 68 | 69 | if $rsyslog::manage_package { 70 | Package[$rsyslog::package_name] -> File[$rsyslog::config_file] 71 | } 72 | } 73 | 74 | if $rsyslog::manage_service { 75 | service { $rsyslog::service_name: 76 | ensure => $rsyslog::service_status, 77 | enable => $rsyslog::service_enabled, 78 | } 79 | 80 | if $rsyslog::manage_confdir { 81 | File[$rsyslog::confdir] ~> Service[$rsyslog::service_name] 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /manifests/component/action.pp: -------------------------------------------------------------------------------- 1 | define rsyslog::component::action ( 2 | Integer $priority, 3 | String $target, 4 | String $confdir, 5 | String $type, 6 | Hash $config = {}, 7 | String[1] $facility = 'default', 8 | String[1] $format = '<%= $content %>' 9 | ) { 10 | include rsyslog 11 | 12 | $content = epp('rsyslog/action.epp', { 13 | 'action_name' => $name, 14 | 'type' => $type, 15 | 'facility' => $facility, 16 | 'config' => $config, 17 | }) 18 | 19 | rsyslog::generate_concat { "rsyslog::concat::action::${title}": 20 | confdir => $confdir, 21 | target => $target, 22 | before => Concat::Fragment["rsyslog::component::action::${title}"], 23 | } 24 | 25 | concat::fragment { "rsyslog::component::action::${name}": 26 | target => "${confdir}/${target}", 27 | content => inline_epp($format), 28 | order => $priority, 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /manifests/component/custom_config.pp: -------------------------------------------------------------------------------- 1 | # This is a catch-all definition for use in edge cases where some code needs 2 | # inserting somewhere in rsyslog.d according to priority but cannot be modelled 3 | # with any of the shipped models. 4 | # 5 | define rsyslog::component::custom_config ( 6 | String $content, 7 | Integer $priority = $rsyslog::custom_priority, 8 | String $target = "${name}.conf", 9 | String $confdir = $rsyslog::confdir, 10 | String $filename_part = $name, 11 | ) { 12 | include rsyslog 13 | 14 | rsyslog::generate_concat { "rsyslog::concat::custom_config::${name}": 15 | confdir => $confdir, 16 | target => $target, 17 | before => Concat::Fragment["rsyslog::component::custom_config::${name}"], 18 | } 19 | 20 | concat::fragment { "rsyslog::component::custom_config::${name}": 21 | target => "${confdir}/${target}", 22 | order => $priority, 23 | content => $content, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /manifests/component/expression_filter.pp: -------------------------------------------------------------------------------- 1 | define rsyslog::component::expression_filter ( 2 | Integer $priority, 3 | String $target, 4 | String $confdir, 5 | Hash $conditionals, 6 | String $format = '<%= $content %>' 7 | ) { 8 | include rsyslog 9 | 10 | $content = epp('rsyslog/expression_filter.epp', { 11 | 'filter_name' => $name, 12 | 'cases' => $conditionals, 13 | }) 14 | 15 | rsyslog::generate_concat { "rsyslog::concat::expression_filter::${name}": 16 | confdir => $confdir, 17 | target => $target, 18 | before => Concat::Fragment["rsyslog::component::expression_filter::${name}"], 19 | } 20 | 21 | concat::fragment { "rsyslog::component::expression_filter::${name}": 22 | target => "${confdir}/${target}", 23 | content => inline_epp($format), 24 | order => $priority, 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /manifests/component/global_config.pp: -------------------------------------------------------------------------------- 1 | define rsyslog::component::global_config ( 2 | Integer $priority, 3 | String $target, 4 | String $confdir, 5 | Optional[String[1]] $value = undef, 6 | Hash $config = {}, 7 | String[1] $type = 'rainerscript', 8 | String[1] $format = '<%= $content %>' 9 | ) { 10 | include rsyslog 11 | 12 | if $type == 'legacy' { 13 | $content = epp('rsyslog/global_config.epp', { 14 | 'config_item' => $name, 15 | 'type' => $type, 16 | 'value' => $value 17 | }) 18 | } else { 19 | $content = epp('rsyslog/global_config', { 20 | 'type' => $type, 21 | 'config' => $config, 22 | }) 23 | } 24 | 25 | rsyslog::generate_concat { "rsyslog::concat::global_config::${name}": 26 | confdir => $confdir, 27 | target => $target, 28 | before => Concat::Fragment["rsyslog::component::global_config::${name}"], 29 | } 30 | 31 | concat::fragment { "rsyslog::component::global_config::${name}": 32 | target => "${confdir}/${target}", 33 | content => inline_epp($format), 34 | order => $priority, 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /manifests/component/input.pp: -------------------------------------------------------------------------------- 1 | define rsyslog::component::input ( 2 | Integer $priority, 3 | String $target, 4 | String $confdir, 5 | String $type, 6 | Hash $config = {}, 7 | String[1] $format = '<%= $content %>' 8 | ) { 9 | include rsyslog 10 | 11 | $content = epp('rsyslog/input.epp', { 12 | 'input_name' => $name, 13 | 'type' => $type, 14 | 'config' => $config 15 | }) 16 | 17 | rsyslog::generate_concat { "rsyslog::concat::input::${name}": 18 | confdir => $confdir, 19 | target => $target, 20 | before => Concat::Fragment["rsyslog::component::input::${name}"], 21 | } 22 | 23 | concat::fragment { "rsyslog::component::input::${name}": 24 | target => "${confdir}/${target}", 25 | content => inline_epp($format), 26 | order => $priority, 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /manifests/component/legacy_config.pp: -------------------------------------------------------------------------------- 1 | define rsyslog::component::legacy_config ( 2 | Integer $priority, 3 | String $target, 4 | String $confdir, 5 | String $value, 6 | String[1] $key = 'legacy_key', 7 | String[1] $type = 'sysklogd', 8 | String[1] $format = '<%= $content %>' 9 | ) { 10 | include rsyslog 11 | 12 | $content = epp('rsyslog/legacy_config.epp', { 13 | 'config_item' => $name, 14 | 'type' => $type, 15 | 'key' => $key, 16 | 'value' => $value, 17 | }) 18 | 19 | rsyslog::generate_concat { "rsyslog::concat::legacy_config::${name}": 20 | confdir => $confdir, 21 | target => $target, 22 | before => Concat::Fragment["rsyslog::component::legacy_config::${name}"], 23 | } 24 | 25 | concat::fragment { "rsyslog::component::legacy_config::${name}": 26 | target => "${confdir}/${target}", 27 | content => inline_epp($format), 28 | order => $priority, 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /manifests/component/lookup_table.pp: -------------------------------------------------------------------------------- 1 | define rsyslog::component::lookup_table ( 2 | Integer $priority, 3 | String $target, 4 | String $confdir, 5 | Hash $lookup_json, 6 | Stdlib::AbsolutePath $lookup_file, 7 | Boolean $reload_on_hup, 8 | Boolean $rsyslog_in_docker = false, 9 | Optional[Stdlib::AbsolutePath] $json_file = undef, 10 | String[1] $format = '<%= $content %>' 11 | ) { 12 | include rsyslog 13 | 14 | if $rsyslog_in_docker { 15 | $_json_file = $json_file 16 | } else { 17 | $_json_file = $lookup_file 18 | } 19 | 20 | file { "rsyslog::component::lookup_table_json::${title}": 21 | path => $_json_file, 22 | content => inline_template('<%= JSON.pretty_generate @lookup_json %>'), 23 | owner => 'root', 24 | group => 'root', 25 | mode => '0644', 26 | } 27 | 28 | $content = epp('rsyslog/lookup_table.epp', { 29 | 'lookup_table_name' => $name, 30 | 'file' => $lookup_file, 31 | 'reload_on_hup' => $reload_on_hup, 32 | }) 33 | 34 | rsyslog::generate_concat { "rsyslog::concat::lookup_table::${name}": 35 | confdir => $confdir, 36 | target => $target, 37 | before => Concat::Fragment["rsyslog::component::lookup_table::${name}"], 38 | } 39 | 40 | concat::fragment { "rsyslog::component::lookup_table::${name}": 41 | target => "${confdir}/${target}", 42 | content => inline_epp($format), 43 | order => $priority, 44 | require => File["rsyslog::component::lookup_table_json::${title}"], 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /manifests/component/main_queue.pp: -------------------------------------------------------------------------------- 1 | define rsyslog::component::main_queue ( 2 | Integer $priority, 3 | String $target, 4 | String $confdir, 5 | Hash $config, 6 | ) { 7 | include rsyslog 8 | 9 | rsyslog::generate_concat { "rsyslog::concat::main_queue::${name}": 10 | confdir => $confdir, 11 | target => $target, 12 | before => Concat::Fragment["rsyslog::component::main_queue::${name}"], 13 | } 14 | 15 | concat::fragment { "rsyslog::component::main_queue::${name}": 16 | order => $priority, 17 | target => "${confdir}/${target}", 18 | content => epp('rsyslog/generic.epp', 19 | { 20 | 'object_name' => 'main_queue', 21 | 'config' => $config 22 | }), 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /manifests/component/module.pp: -------------------------------------------------------------------------------- 1 | define rsyslog::component::module ( 2 | Integer $priority, 3 | String $target, 4 | String $confdir, 5 | Hash $config = {}, 6 | String[1] $type = 'external', 7 | String[1] $format = '<%= $content %>' 8 | ) { 9 | include rsyslog 10 | 11 | $content = epp('rsyslog/modules.epp', { 12 | 'config_item' => $name, 13 | 'type' => $type, 14 | 'config' => $config, 15 | }) 16 | 17 | rsyslog::generate_concat { "rsyslog::concat::module::${name}": 18 | confdir => $confdir, 19 | target => $target, 20 | before => Concat::Fragment["rsyslog::component::module::${name}"], 21 | } 22 | 23 | concat::fragment { "rsyslog::component::module::${name}": 24 | target => "${confdir}/${target}", 25 | content => inline_epp($format), 26 | order => $priority, 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /manifests/component/parser.pp: -------------------------------------------------------------------------------- 1 | define rsyslog::component::parser ( 2 | Integer $priority, 3 | String $target, 4 | String $confdir, 5 | String $type, 6 | Hash $config = {}, 7 | String[1] $format = '<%= $content %>' 8 | ) { 9 | include rsyslog 10 | 11 | $content = epp('rsyslog/parser.epp', { 12 | 'parser_name' => $name, 13 | 'type' => $type, 14 | 'config' => $config 15 | }) 16 | 17 | rsyslog::generate_concat { "rsyslog::concat::parser::${name}": 18 | confdir => $confdir, 19 | target => $target, 20 | before => Concat::Fragment["rsyslog::component::parser::${name}"], 21 | } 22 | 23 | concat::fragment { "rsyslog::component::parser::${name}": 24 | target => "${confdir}/${target}", 25 | content => inline_epp($format), 26 | order => $priority, 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /manifests/component/property_filter.pp: -------------------------------------------------------------------------------- 1 | define rsyslog::component::property_filter ( 2 | Integer $priority, 3 | String $target, 4 | String $confdir, 5 | String $property, 6 | Rsyslog::PropertyOperator $operator, 7 | String $value, 8 | Array $tasks = [], 9 | String $format = '<%= $content %>' 10 | ) { 11 | include rsyslog 12 | 13 | $content = epp('rsyslog/property_filter.epp', { 14 | 'filter_name' => $name, 15 | 'property' => $property, 16 | 'operator' => $operator, 17 | 'value' => $value, 18 | 'tasks' => $tasks, 19 | }) 20 | 21 | rsyslog::generate_concat { "rsyslog::concat::property_filter::${name}": 22 | confdir => $confdir, 23 | target => $target, 24 | before => Concat::Fragment["rsyslog::component::property_filter::${name}"], 25 | } 26 | 27 | concat::fragment { "rsyslog::component::property_filter::${name}": 28 | target => "${confdir}/${target}", 29 | content => inline_epp($format), 30 | order => $priority, 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /manifests/component/ruleset.pp: -------------------------------------------------------------------------------- 1 | define rsyslog::component::ruleset ( 2 | Integer $priority, 3 | String $target, 4 | String $confdir, 5 | Array $rules = [], 6 | Boolean $stop = false, 7 | Hash $parameters = {}, 8 | String[1] $format = '<%= $content %>' 9 | ) { 10 | include rsyslog 11 | 12 | if $rules == [] and $stop == false { 13 | fail('Ruleset MUST have at least one of: action, stop, set, call, or lookup') 14 | } 15 | 16 | $content = epp('rsyslog/ruleset.epp', { 17 | 'ruleset_name' => $name, 18 | 'parameters' => $parameters, 19 | 'rules' => $rules, 20 | 'stop' => $stop, 21 | }) 22 | 23 | rsyslog::generate_concat { "rsyslog::concat::ruleset::${name}": 24 | confdir => $confdir, 25 | target => $target, 26 | before => Concat::Fragment["rsyslog::component::ruleset::${name}"], 27 | } 28 | 29 | concat::fragment { "rsyslog::component::ruleset::${name}": 30 | target => "${confdir}/${target}", 31 | content => inline_epp($format), 32 | order => $priority, 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /manifests/component/template.pp: -------------------------------------------------------------------------------- 1 | define rsyslog::component::template ( 2 | Integer $priority, 3 | String $target, 4 | String $confdir, 5 | Enum['string', 'list', 'subtree', 'plugin'] $type, 6 | Array $list_descriptions = [], 7 | # lint:ignore:params_empty_string_assignment 8 | String $string = '', 9 | String $subtree = '', 10 | String $plugin = '', 11 | # lint:endignore 12 | Hash $options = {}, 13 | String[1] $format = '<%= $content %>' 14 | ) { 15 | include rsyslog 16 | 17 | $content = epp('rsyslog/template.epp', 18 | { 19 | 'string' => $string, 20 | 'list_descriptions' => $list_descriptions, 21 | 'type' => $type, 22 | 'template_name' => $name, 23 | 'subtree' => $subtree, 24 | 'plugin' => $plugin, 25 | 'options' => $options, 26 | }) 27 | 28 | rsyslog::generate_concat { "rsyslog::concat::template::${name}": 29 | confdir => $confdir, 30 | target => $target, 31 | before => Concat::Fragment["rsyslog::component::template::${name}"], 32 | } 33 | 34 | concat::fragment { "rsyslog::component::template::${name}": 35 | target => "${confdir}/${target}", 36 | content => inline_epp($format), 37 | order => $priority, 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /manifests/config.pp: -------------------------------------------------------------------------------- 1 | # @summary 2 | # Manage the configuration parameters for rsyslog. 3 | # This class can be called explicitly or through the use of 4 | # hieradata. 5 | # 6 | # @author Vox Pupuli 7 | # 8 | # @example using class 9 | # class { 'rsyslog::config': 10 | # global_config => { 11 | # 'workDirectory' => { 12 | # 'value' => '/var/spool/rsyslog', 13 | # }, 14 | # 'maxMessageSize' => { 15 | # 'value' => '64k' 16 | # } 17 | # }, 18 | # actions => { 19 | # 'all_logs' => { 20 | # 'type' => 'omfile', 21 | # 'facility' => '*.*;auth,authpriv.none', 22 | # 'config' => { 23 | # 'dynaFile' => 'remoteSyslog', 24 | # 'specifics' => '/var/log/test', 25 | # }, 26 | # }, 27 | # }, 28 | # } 29 | # 30 | # @example using hieradata 31 | # # Include class 32 | # include rsyslog::config 33 | # 34 | # # Hieradata 35 | # --- 36 | # rsyslog::config::global_config: 37 | # workDirectory: 38 | # value: '/var/spool/rsyslog' 39 | # maxMessageSize: 40 | # value: '64k' 41 | # rsyslog::config::actions: 42 | # all_logs: 43 | # type: omfile 44 | # factiliy: "*.*;auth,authpriv.none" 45 | # config: 46 | # dynaFile: remoteSyslog 47 | # specifics: '/var/log/test' 48 | # 49 | # @param global_config 50 | # Hash of global configuration options. Supports both Rainerscript and Legacy 51 | # configuration formats depending on the configuration option. 52 | # * :name (String) [undef] Name of the global configuration option to set. 53 | # * :priority (Integer) [10] Sets where in the config the option will be placed in the target file. 54 | # * :target (String) [50_rsyslog.conf] File to place the conf 55 | # * :confdir (String) [/etc/rsyslog.d] Directory where the configuration file exists. 56 | # * :value (String) [] Value of the configuration item 57 | # * :config (Hash) [{}] Hash of configuration data for the option. Contents 58 | # dependent on the configuration option. 59 | # * :type (Enum['rainerscript', 'legacy']) [rainerscript] configuration format to use. 60 | # * :format (String) ['<%= $content %>'] The content format. Defaults to epp template code. 61 | # @param legacy_config 62 | # Hash of rsyslog configuration in the legacy format. 63 | # * :name (String) [undef] Name of the legacy configuration option. 64 | # * :priority (Integer) [10] Sets where in the config the option will be placed in the target file. 65 | # * :target (String) [50_rsyslog.conf] File to place the conf 66 | # * :value (String) [] Value of the configuration item 67 | # * :confdir (String) [/etc/rsyslog.d] The configuration directory where config file exists. 68 | # * :key (String) [legacy_key] The rsyslog legacy configuration key name 69 | # * :type (String) [sysklogd] The type of legacy configuration it is. 70 | # * :format (String) ['<%= $content %>'] The content format. Defaults to epp template code. 71 | # @param templates 72 | # Hash of rsyslog templates. 73 | # * :name (String) [undef] Name of the global configuration option to set. 74 | # * :priority (Integer) [10] Sets where in the config the option will be placed in the target file. 75 | # * :target (String) [50_rsyslog.conf] File to place the conf 76 | # * :confdir (String) [/etc/rsyslog.d] Directory where the configuration file exists. 77 | # * :type (Enum['string', 'list', 'subtree', 'plugin']) [undef] Rsyslog template type. 78 | # * :list_descriptions (Array) [[]] An array of hashes representing list 79 | # template constants and properties 80 | # * :string (String) [''] String value for a String template. 81 | # * :subtree (String) [''] String representation of the subtree value. 82 | # * :plugin (String) [''] Name of the plugin the template will use. 83 | # * :options (Hash) [{}] Hash of additional template options. 84 | # * :format (String) ['<%= $content %>'] The content format. Defaults to epp template code. 85 | # @param actions 86 | # Hash of rsyslog actions. 87 | # * :name (String) [undef] Name of the global configuration option to set. 88 | # * :priority (Integer) [10] Sets where in the config the option will be placed in the target file. 89 | # * :target (String) [50_rsyslog.conf] File to place the conf 90 | # * :confdir (String) [/etc/rsyslog.d] Directory where the configuration file exists. 91 | # * :type (String) [undef] Type of output module the action will use. 92 | # * :config (Optional[Hash]) [undef] A hash of output module specific configuration options. 93 | # * :facility (String) ['default'] The syslog facility to use when outputting this action. 94 | # * :format (String) ['<%= $content %>'] The content format. Defaults to epp template code. 95 | # @param inputs 96 | # Hash of rsyslog input plugins to use. 97 | # * :name (String) [undef] Name of the global configuration option to set. 98 | # * :priority (Integer) [10] Sets where in the config the option will be placed in the target file. 99 | # * :target (String) [50_rsyslog.conf] File to place the conf 100 | # * :confdir (String) [/etc/rsyslog.d] Directory where the configuration file exists. 101 | # * :type (String) [undef] The name of the input module to use. 102 | # * :config (Optional[Hash]) [undef] Hash of input module specific 103 | # configuration settings. Depends on value of type 104 | # * :format (String) ['<%= $content %>'] The content format. Defaults to epp template code. 105 | # @param custom_config 106 | # Hash of custom raw configuration to place in the rsyslog config file. 107 | # * :name (String) [undef] Name of the global configuration option to set. 108 | # * :priority (Integer) [10] Sets where in the config the option will be placed in the target file. 109 | # * :target (String) [50_rsyslog.conf] File to place the conf 110 | # * :confdir (String) [/etc/rsyslog.d] Directory where the configuration file exists. 111 | # * :content (String) [undef] The single/multi-line string representing the config. 112 | # 113 | class rsyslog::config ( 114 | Hash $global_config = {}, 115 | Hash $legacy_config = {}, 116 | Hash $templates = {}, 117 | Hash $actions = {}, 118 | Hash $inputs = {}, 119 | Hash $custom_config = {}, 120 | Hash $main_queue_opts = {}, 121 | Hash $modules = {}, 122 | Hash $lookup_tables = {}, 123 | Hash $parsers = {}, 124 | Hash $rulesets = {}, 125 | Hash $property_filters = {}, 126 | Hash $expression_filters = {}, 127 | ) { 128 | include rsyslog 129 | 130 | include rsyslog::config::modules 131 | include rsyslog::config::global 132 | include rsyslog::config::legacy 133 | include rsyslog::config::main_queue 134 | include rsyslog::config::templates 135 | include rsyslog::config::actions 136 | include rsyslog::config::inputs 137 | include rsyslog::config::custom 138 | include rsyslog::config::lookup_tables 139 | include rsyslog::config::parsers 140 | include rsyslog::config::rulesets 141 | include rsyslog::config::property_filters 142 | include rsyslog::config::expression_filters 143 | } 144 | -------------------------------------------------------------------------------- /manifests/config/actions.pp: -------------------------------------------------------------------------------- 1 | class rsyslog::config::actions { 2 | $rsyslog::config::actions.each |$action, $config| { 3 | rsyslog::component::action { $action: 4 | * => { 5 | 'priority' => $rsyslog::action_priority, 6 | 'target' => $rsyslog::target_file, 7 | 'confdir' => $rsyslog::confdir, 8 | } + $config, 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /manifests/config/custom.pp: -------------------------------------------------------------------------------- 1 | class rsyslog::config::custom { 2 | $rsyslog::config::custom_config.each |$conf_name, $config| { 3 | rsyslog::component::custom_config { $conf_name: 4 | * => { 5 | 'priority' => $rsyslog::custom_priority, 6 | 'target' => $rsyslog::target_file, 7 | 'confdir' => $rsyslog::confdir, 8 | } + $config, 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /manifests/config/expression_filters.pp: -------------------------------------------------------------------------------- 1 | class rsyslog::config::expression_filters { 2 | $rsyslog::config::expression_filters.each |$filter, $config| { 3 | rsyslog::component::expression_filter { $filter: 4 | * => { 5 | 'priority' => $rsyslog::filter_priority, 6 | 'target' => $rsyslog::target_file, 7 | 'confdir' => $rsyslog::confdir, 8 | } + $config, 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /manifests/config/global.pp: -------------------------------------------------------------------------------- 1 | class rsyslog::config::global { 2 | #create a hash just with legacy type values 3 | $legacytype = $rsyslog::config::global_config.filter |$key, $value| { 'type' in $value } 4 | 5 | $legacytype.each |$param, $config| { 6 | rsyslog::component::global_config { $param: 7 | * => { 8 | 'priority' => $rsyslog::global_config_priority, 9 | 'target' => $rsyslog::target_file, 10 | 'confdir' => $rsyslog::confdir, 11 | } + $config, 12 | } 13 | } 14 | 15 | #create a hash just with the non legacy type value 16 | $newtype = $rsyslog::config::global_config.filter |$key, $value| { ! ('type' in $value) } 17 | 18 | #flatten the nested hash of hashes to one single hash 19 | $flattendata = $newtype.keys.reduce({}) |$memo, $key| { $memo + { $key => $newtype[$key]["value"] } } 20 | 21 | unless empty($flattendata) { 22 | rsyslog::component::global_config { 23 | default: 24 | priority => $rsyslog::global_config_priority, 25 | target => $rsyslog::target_file, 26 | confdir => $rsyslog::confdir, 27 | ; 28 | 'rainerscript': 29 | config => $flattendata, 30 | ; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /manifests/config/inputs.pp: -------------------------------------------------------------------------------- 1 | class rsyslog::config::inputs { 2 | $rsyslog::config::inputs.each |$input, $config| { 3 | rsyslog::component::input { $input: 4 | * => { 5 | 'priority' => $rsyslog::input_priority, 6 | 'target' => $rsyslog::target_file, 7 | 'confdir' => $rsyslog::confdir, 8 | } + $config, 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /manifests/config/legacy.pp: -------------------------------------------------------------------------------- 1 | class rsyslog::config::legacy { 2 | $rsyslog::config::legacy_config.each |$name, $config| { 3 | rsyslog::component::legacy_config { $name: 4 | * => { 5 | 'priority' => $rsyslog::legacy_config_priority, 6 | 'target' => $rsyslog::target_file, 7 | 'confdir' => $rsyslog::confdir, 8 | } + $config, 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /manifests/config/lookup_tables.pp: -------------------------------------------------------------------------------- 1 | class rsyslog::config::lookup_tables { 2 | $rsyslog::config::lookup_tables.each |$table, $config| { 3 | rsyslog::component::lookup_table { $table: 4 | * => { 5 | 'priority' => $rsyslog::lookup_table_priority, 6 | 'target' => $rsyslog::target_file, 7 | 'confdir' => $rsyslog::confdir, 8 | } + $config, 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /manifests/config/main_queue.pp: -------------------------------------------------------------------------------- 1 | class rsyslog::config::main_queue { 2 | unless empty($rsyslog::config::main_queue_opts) { 3 | rsyslog::component::main_queue { 4 | default: 5 | priority => $rsyslog::main_queue_priority, 6 | target => $rsyslog::target_file, 7 | confdir => $rsyslog::confdir, 8 | ; 9 | 'main_queue_opts': 10 | config => $rsyslog::config::main_queue_opts, 11 | ; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /manifests/config/modules.pp: -------------------------------------------------------------------------------- 1 | class rsyslog::config::modules { 2 | $rsyslog::config::modules.each|$name, $config| { 3 | rsyslog::component::module { $name: 4 | * => { 5 | 'priority' => $rsyslog::module_load_priority, 6 | 'target' => $rsyslog::target_file, 7 | 'confdir' => $rsyslog::confdir, 8 | } + $config, 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /manifests/config/parsers.pp: -------------------------------------------------------------------------------- 1 | class rsyslog::config::parsers { 2 | $rsyslog::config::parsers.each |$parser, $config| { 3 | rsyslog::component::parser { $parser: 4 | * => { 5 | 'priority' => $rsyslog::parser_priority, 6 | 'target' => $rsyslog::target_file, 7 | 'confdir' => $rsyslog::confdir, 8 | } + $config, 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /manifests/config/property_filters.pp: -------------------------------------------------------------------------------- 1 | class rsyslog::config::property_filters { 2 | $rsyslog::config::property_filters.each |$filter, $config| { 3 | rsyslog::component::property_filter { $filter: 4 | * => { 5 | 'priority' => $rsyslog::filter_priority, 6 | 'target' => $rsyslog::target_file, 7 | 'confdir' => $rsyslog::confdir, 8 | } + $config, 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /manifests/config/rulesets.pp: -------------------------------------------------------------------------------- 1 | class rsyslog::config::rulesets { 2 | $rsyslog::config::rulesets.each |$ruleset, $config| { 3 | rsyslog::component::ruleset { $ruleset: 4 | * => { 5 | 'priority' => $rsyslog::ruleset_priority, 6 | 'target' => $rsyslog::target_file, 7 | 'confdir' => $rsyslog::confdir, 8 | } + $config, 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /manifests/config/templates.pp: -------------------------------------------------------------------------------- 1 | class rsyslog::config::templates { 2 | $rsyslog::config::templates.each |$template, $config| { 3 | rsyslog::component::template { $template: 4 | * => { 5 | 'priority' => $rsyslog::template_priority, 6 | 'target' => $rsyslog::target_file, 7 | 'confdir' => $rsyslog::confdir, 8 | } + $config, 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /manifests/generate_concat.pp: -------------------------------------------------------------------------------- 1 | define rsyslog::generate_concat ( 2 | String $confdir, 3 | String $target, 4 | ) { 5 | if $rsyslog::manage_service or $rsyslog::external_service { 6 | if ! defined(Concat["${confdir}/${target}"]) { 7 | concat { "${confdir}/${target}": 8 | owner => 'root', 9 | notify => Service[$rsyslog::service_name], 10 | order => 'numeric', 11 | mode => $rsyslog::conf_permissions, 12 | warn => true, 13 | } 14 | } 15 | } else { 16 | if ! defined(Concat["${confdir}/${target}"]) { 17 | concat { "${confdir}/${target}": 18 | owner => 'root', 19 | order => 'numeric', 20 | mode => $rsyslog::conf_permissions, 21 | warn => true, 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /manifests/init.pp: -------------------------------------------------------------------------------- 1 | # @summary 2 | # Manage the Rsyslog daemon package, service, and 3 | # configuration. 4 | # 5 | # @author Vox Pupuli 6 | # 7 | # @example using class 8 | # class { 'rsyslog': 9 | # manage_service => true, 10 | # } 11 | # 12 | # @example using hieradata 13 | # # Manifest 14 | # include rsyslog 15 | # include rsyslog::config 16 | # 17 | # # Hieradata 18 | # --- 19 | # rsyslog::confdir: /etc/rsyslog.d 20 | # rsyslog::package_name: rsyslog 21 | # rsyslog::config::global_config: 22 | # workDirectory: 23 | # value: '/var/spool/rsyslog' 24 | # 25 | # @param confdir 26 | # The rsyslog configuration directory. 27 | # @param package_name 28 | # The name of the rsyslog package to install. 29 | # @param package_version 30 | # The version of rsyslog to install. 31 | # @param config_file 32 | # The global rsyslog configuration file. 33 | # @param feature_packages 34 | # List of additional rsyslog packages to install. 35 | # @param module_load_priority 36 | # Order the loading of rsyslog modules relative to other configuration. 37 | # @param service_name 38 | # Name of the SystemD, Upstart, or SysVInit service. 39 | # @param service_status 40 | # State desired for the rsyslog service. 41 | # @param service_enabled 42 | # Is the service enabled or not. 43 | # @param override_default_config 44 | # Override the default rsyslog.conf file. 45 | # @param manage_package 46 | # Toggle the managing of the rsyslog package. 47 | # @param use_upstream_repo 48 | # Toggle using the upstream Adiscon Rsyslog repository. 49 | # @param manage_confdir 50 | # Toggle management of the Rsyslog configuration directory. 51 | # @param manage_service 52 | # Toggle management of the rsyslog service. 53 | # @param external_service 54 | # Toggle if the service is external to where rsyslog is being run. 55 | # I.E. a service that starts a docker container running rsyslog. 56 | # @param purge_config_files 57 | # Toggle purging of unmanaged configuration files. 58 | # @param global_config_priority 59 | # Set the global ordering of global configuration parameters in rsyslog. 60 | # @param legacy_config_priority 61 | # Set the global ordering of legacy configuration parameters in rsyslog. 62 | # @param template_priority 63 | # Set the global ordering of template configuration in rsyslog. 64 | # @param action_priority 65 | # Set the global ordering of action configuration in rsyslog. 66 | # @param input_priority 67 | # Set the global ordering of input configuration in rsyslog. 68 | # @param custom_priority 69 | # Set the global ordering of custom configuration in rsyslog. 70 | # @param main_queue_priority 71 | # Set the global ordering of main queue configuration in rsyslog. 72 | # @param lookup_table_priority 73 | # Set the global ordering of lookup table configuration in rsyslog. 74 | # @param parser_priorty 75 | # Set the global ordering of parser configuration in rsyslog. 76 | # @param ruleset_priority 77 | # Set the global ordering of rulesets configuration in rsyslog. 78 | # @param filter_priority 79 | # Set the global ordering of filter configuration in rsyslog. 80 | # @param target_file 81 | # Target file to insert configuration into. 82 | # @param conf_permissions 83 | # Set the file mode for the generated configuration files. 84 | # @param confdir_permissions 85 | # Set the file mode for the rsyslog.d configuration directory. 86 | # @param global_conf_perms 87 | # Set the file mode for the /etc/rsyslog.conf 88 | # @param config_file_include 89 | # Override the include directive in the /etc/rsyslog.conf file. 90 | # 91 | class rsyslog ( 92 | String $confdir, 93 | String $package_name, 94 | String $package_version, 95 | String $config_file, 96 | Array $feature_packages, 97 | Integer $module_load_priority, 98 | String $service_name, 99 | String $service_status, 100 | Boolean $service_enabled, 101 | Boolean $override_default_config, 102 | Boolean $manage_package, 103 | Boolean $use_upstream_repo, 104 | Boolean $manage_confdir, 105 | Boolean $manage_service, 106 | Boolean $external_service, 107 | Boolean $purge_config_files, 108 | Integer $global_config_priority, 109 | Integer $legacy_config_priority, 110 | Integer $template_priority, 111 | Integer $action_priority, 112 | Integer $input_priority, 113 | Integer $custom_priority, 114 | Integer $main_queue_priority, 115 | Integer $lookup_table_priority, 116 | Integer $parser_priority, 117 | Integer $ruleset_priority, 118 | Integer $filter_priority, 119 | String $target_file, 120 | Stdlib::Filemode $conf_permissions = '0644', 121 | Stdlib::Filemode $confdir_permissions = '0755', 122 | Stdlib::Filemode $global_conf_perms = $conf_permissions, 123 | String $config_file_include = "include(file=\"${rsyslog::confdir}/*.conf\" mode=\"optional\")", 124 | ) { 125 | if $manage_service == true and $external_service == true { 126 | fail('manage_service and external_service cannot be set at the same time!') 127 | } else { 128 | contain 'rsyslog::base' 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "puppet-rsyslog", 3 | "version": "7.3.1-rc0", 4 | "author": "Vox Pupuli", 5 | "summary": "Manage rsyslog v8 configuration", 6 | "license": "Apache-2.0", 7 | "source": "https://github.com/voxpupuli/puppet-rsyslog", 8 | "project_page": "https://github.com/voxpupuli/puppet-rsyslog", 9 | "issues_url": "https://github.com/voxpupuli/puppet-rsyslog/issues", 10 | "operatingsystem_support": [ 11 | { 12 | "operatingsystem": "RedHat", 13 | "operatingsystemrelease": [ 14 | "7", 15 | "8", 16 | "9" 17 | ] 18 | }, 19 | { 20 | "operatingsystem": "CentOS", 21 | "operatingsystemrelease": [ 22 | "7", 23 | "8", 24 | "9" 25 | ] 26 | }, 27 | { 28 | "operatingsystem": "OracleLinux", 29 | "operatingsystemrelease": [ 30 | "7", 31 | "8" 32 | ] 33 | }, 34 | { 35 | "operatingsystem": "Scientific", 36 | "operatingsystemrelease": [ 37 | "7" 38 | ] 39 | }, 40 | { 41 | "operatingsystem": "Ubuntu", 42 | "operatingsystemrelease": [ 43 | "18.04" 44 | ] 45 | }, 46 | { 47 | "operatingsystem": "Debian", 48 | "operatingsystemrelease": [] 49 | }, 50 | { 51 | "operatingsystem": "Fedora", 52 | "operatingsystemrelease": [ 53 | "38" 54 | ] 55 | } 56 | ], 57 | "dependencies": [ 58 | { 59 | "name": "puppetlabs-apt", 60 | "version_requirement": ">= 5.0.0 < 11.0.0" 61 | }, 62 | { 63 | "name": "puppetlabs-concat", 64 | "version_requirement": ">= 4.1.0 < 10.0.0" 65 | }, 66 | { 67 | "name": "puppetlabs-stdlib", 68 | "version_requirement": ">= 4.25.0 < 10.0.0" 69 | } 70 | ], 71 | "requirements": [ 72 | { 73 | "name": "puppet", 74 | "version_requirement": ">= 7.0.0 < 9.0.0" 75 | }, 76 | { 77 | "name": "openvox", 78 | "version_requirement": ">= 7.0.0 < 9.0.0" 79 | } 80 | ] 81 | } 82 | -------------------------------------------------------------------------------- /spec/acceptance/actions_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper_acceptance' 4 | 5 | describe 'Rsyslog actions' do 6 | before(:context) do 7 | cleanup_helper 8 | end 9 | 10 | context 'basic action' do 11 | it 'applies with action' do 12 | pp = <<-MANIFEST 13 | if $facts['os']['name'] == 'Fedora' { 14 | package { 'rsyslog-elasticsearch': ensure => installed } 15 | } 16 | 17 | class { 'rsyslog::config': 18 | actions => { 19 | 'omfile_all_logs' => { 20 | 'type' => 'omfile', 21 | 'config' => { 22 | 'queue.type' => 'LinkedList', 23 | 'queue.spoolDirectory' => '/var/log/rsyslog/queue', 24 | 'file' => '/tmp/log', 25 | } 26 | }, 27 | 'myaction' => { 28 | 'type' => 'omelasticsearch', 29 | 'config' => { 30 | 'host' => ["127.0.0.1", "192.168.0.1"], 31 | 'queue.type' => 'linkedlist', 32 | 'queue.spoolDirectory' => '/var/log/rsyslog/queue' 33 | } 34 | } 35 | } 36 | } 37 | MANIFEST 38 | 39 | apply_manifest(pp, catch_failures: true) 40 | apply_manifest(pp, catch_changes: true) 41 | end 42 | 43 | describe file('/etc/rsyslog.d/50_rsyslog.conf') do 44 | its(:content) do 45 | is_expected.to match(%r{# omfile_all_logs\naction\(type="omfile"\n.*name="omfile_all_logs"\n.*queue.type="LinkedList"\n.*queue.spoolDirectory="/var/log/rsyslog/queue"\n.*file="/tmp/log"\n.*\)}) 46 | is_expected.to match(%r{# myaction\naction\(type="omelasticsearch"\n.*name="myaction"\n.*host=\["127.0.0.1", "192.168.0.1"\]\n.*queue.type="linkedlist"\n.*queue.spoolDirectory="/var/log/rsyslog/queue"\n.*\)}) 47 | end 48 | end 49 | 50 | # rm the rsyslog-elasticsearch package as it will block the uninstall of 51 | # the rsyslog package in other acceptance tests 52 | if fact('os.name') == 'Fedora' 53 | it 'applies with action' do 54 | pp = <<-MANIFEST 55 | if $facts['os']['name'] == 'Fedora' { 56 | package { 'rsyslog-elasticsearch': ensure => absent } 57 | } 58 | MANIFEST 59 | 60 | apply_manifest(pp, catch_failures: true) 61 | apply_manifest(pp, catch_changes: true) 62 | end 63 | end 64 | end 65 | end 66 | -------------------------------------------------------------------------------- /spec/acceptance/base_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper_acceptance' 4 | 5 | describe 'Rsyslog base' do 6 | before(:context) do 7 | cleanup_helper 8 | end 9 | 10 | after(:context) do 11 | cleanup_helper 12 | upstream_cleanup 13 | end 14 | 15 | context 'applies with upstream adiscon repo' do 16 | it 'applies with repo' do 17 | pp = <<-MANIFEST 18 | case $facts['os']['name'] { 19 | 'Ubuntu': { 20 | $overrides = true 21 | $upstream = true 22 | } 23 | 'CentOS', 'OracleLinux', 'RedHat': { 24 | $overrides = false 25 | $upstream = ( Integer($facts['os']['release']['major']) < 9 ) 26 | } 27 | 'Scientific', 'Fedora': { 28 | $overrides = false 29 | $upstream = true 30 | } 31 | default: { 32 | $overrides = true 33 | $upstream = false 34 | } 35 | } 36 | class { 'rsyslog': 37 | use_upstream_repo => $upstream, 38 | override_default_config => $overrides, 39 | purge_config_files => $overrides, 40 | } 41 | MANIFEST 42 | 43 | apply_manifest(pp, catch_failures: true) 44 | apply_manifest(pp, catch_changes: true) 45 | end 46 | end 47 | 48 | case fact('os.family') 49 | when 'RedHat' 50 | if fact('os.release.major').to_i < 9 51 | describe file('/etc/yum.repos.d/upstream_rsyslog.repo') do 52 | it { is_expected.to exist } 53 | end 54 | end 55 | when 'Debian' 56 | next if fact('os.name') != 'Ubuntu' 57 | next if fact('facterversion').split('.').first.to_i < 4 58 | 59 | describe file("/etc/apt/sources.list.d/adiscon-ubuntu-v8-stable-#{fact('os.distro.codename')}.list") do 60 | it { is_expected.to exist } 61 | end 62 | end 63 | end 64 | -------------------------------------------------------------------------------- /spec/acceptance/expression_filter_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper_acceptance' 4 | 5 | describe 'Rsyslog expression filters' do 6 | before(:context) do 7 | cleanup_helper 8 | end 9 | 10 | context 'with simple expression filter' do 11 | it 'applies with a simply expression' do 12 | pp = <<-MANIFEST 13 | class { 'rsyslog::config': 14 | expression_filters => { 15 | 'test_filter' => { 16 | 'conditionals' => { 17 | 'if' => { 18 | 'expression' => 'msg == "test"', 19 | 'tasks' => [ 20 | { 'call' => 'ruleset.action.test' }, 21 | { 'stop' => true }, 22 | ] 23 | } 24 | } 25 | } 26 | } 27 | } 28 | MANIFEST 29 | 30 | apply_manifest(pp, catch_failures: true) 31 | apply_manifest(pp, catch_changes: true) 32 | end 33 | 34 | describe file('/etc/rsyslog.d/50_rsyslog.conf') do 35 | its(:content) { is_expected.to contain('if msg == "test" then {\n call ruleset\.action\.test\n stop\n\s*}') } 36 | end 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /spec/acceptance/inputs_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper_acceptance' 4 | 5 | describe 'Rsyslog inputs' do 6 | before(:context) do 7 | cleanup_helper 8 | end 9 | 10 | context 'basic input' do 11 | it 'applies with inputs' do 12 | pp = <<-MANIFEST 13 | class { 'rsyslog::config': 14 | modules => { 15 | 'imudp' => {}, 16 | 'imptcp' => {}, 17 | }, 18 | inputs => { 19 | 'imudp' => { 20 | 'type' => 'imudp', 21 | 'config' => { 22 | 'port' => '514', 23 | }, 24 | }, 25 | 'imptcp' => { 26 | 'type' => 'imptcp', 27 | 'config' => { 28 | 'port' => '514', 29 | }, 30 | }, 31 | }, 32 | actions => { 33 | 'default_output' => { 34 | 'type' => 'omfile', 35 | 'config' => { 36 | 'queue.type' => 'LinkedList', 37 | 'queue.spoolDirectory' => '/var/log/rsyslog/queue', 38 | 'file' => '/tmp/log', 39 | }, 40 | }, 41 | }, 42 | } 43 | MANIFEST 44 | 45 | apply_manifest(pp, catch_failures: true) 46 | apply_manifest(pp, catch_changes: true) 47 | end 48 | 49 | describe file('/etc/rsyslog.d/50_rsyslog.conf') do 50 | its(:content) { is_expected.to contain('input\(type="imudp"\n\s*port="514"\n\)') } 51 | its(:content) { is_expected.to contain('input\(type="imptcp"\n\s*port="514"\n\)') } 52 | end 53 | end 54 | 55 | context 'inputs with custom priorities' do 56 | it 'applies with custom priorities' do 57 | pp = <<~MANIFEST 58 | class { 'rsyslog::config': 59 | modules => { 60 | 'imfile' => { 61 | 'priority' => 5, 62 | }, 63 | 'imudp' => { 64 | 'priority' => 5, 65 | }, 66 | 'imptcp' => { 67 | 'priority' => 5, 68 | }, 69 | }, 70 | inputs => { 71 | 'imfile' => { 72 | 'priority' => 10, 73 | 'type' => 'imfile', 74 | 'config' => { 75 | 'File' => '/tmp/test-file', 76 | }, 77 | }, 78 | 'imudp' => { 79 | 'priority' => 111, 80 | 'type' => 'imudp', 81 | 'config' => { 82 | 'port' => '514', 83 | }, 84 | }, 85 | 'imptcp' => { 86 | 'priority' => 112, 87 | 'type' => 'imptcp', 88 | 'config' => { 89 | 'port' => '514', 90 | }, 91 | }, 92 | 'imfile2' => { 93 | 'priority' => 50, 94 | 'type' => 'imfile', 95 | 'config' => { 96 | 'File' => '/tmp/test-file2', 97 | }, 98 | }, 99 | }, 100 | actions => { 101 | 'default_output' => { 102 | 'priority' => 113, 103 | 'type' => 'omfile', 104 | 'config' => { 105 | 'queue.type' => 'LinkedList', 106 | 'queue.spoolDirectory' => '/var/log/rsyslog/queue', 107 | 'file' => '/tmp/log', 108 | } 109 | }, 110 | }, 111 | } 112 | MANIFEST 113 | 114 | apply_manifest(pp, catch_failures: true) 115 | apply_manifest(pp, catch_changes: true) 116 | end 117 | 118 | describe file('/etc/rsyslog.d/50_rsyslog.conf') do 119 | its(:content) { is_expected.to contain('input\(type="imfile"\n\s*File="/tmp/test-file"\n\)\n# imfile2\n') } 120 | its(:content) { is_expected.to contain('input\(type="imfile"\n\s*File="/tmp/test-file2"\n\)\n# imudp\n') } 121 | its(:content) { is_expected.to contain('input\(type="imudp"\n\s*port="514"\n\)\n# imptcp\n') } 122 | its(:content) { is_expected.to contain('input\(type="imptcp"\n\s*port="514"\n\)\n') } 123 | end 124 | end 125 | end 126 | -------------------------------------------------------------------------------- /spec/acceptance/rsyslog_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper_acceptance' 4 | 5 | describe 'Rsyslog' do 6 | context 'with defaults' do 7 | before(:context) do 8 | cleanup_helper 9 | end 10 | 11 | it 'applies' do 12 | pp = <<-MANIFEST 13 | case $facts['os']['name'] { 14 | 'Ubuntu': { 15 | $overrides = true 16 | } 17 | 'RedHat', 'CentOS', 'Scientific', 'Fedora', 'OracleLinux': { 18 | $overrides = false 19 | } 20 | } 21 | class { 'rsyslog': 22 | override_default_config => $overrides, 23 | purge_config_files => $overrides, 24 | } 25 | MANIFEST 26 | 27 | apply_manifest(pp, catch_failures: true) 28 | apply_manifest(pp, catch_changes: true) 29 | end 30 | 31 | describe file('/etc/rsyslog.conf') do 32 | it { is_expected.to be_file } 33 | it { is_expected.to be_readable } 34 | end 35 | 36 | describe file('/etc/rsyslog.d') do 37 | it { is_expected.to be_directory } 38 | it { is_expected.to exist } 39 | end 40 | 41 | describe package('rsyslog') do 42 | it { is_expected.to be_installed } 43 | end 44 | 45 | describe service('rsyslog') do 46 | it { is_expected.to be_running } 47 | it { is_expected.to be_enabled } 48 | end 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /spec/acceptance/ruleset_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper_acceptance' 4 | 5 | describe 'Rsyslog::Component::Ruleset' do 6 | before(:context) do 7 | cleanup_helper 8 | end 9 | 10 | it 'applies a ruleset' do 11 | pp = <<-MANIFEST 12 | class { 'rsyslog::config': 13 | rulesets => { 14 | 'action.ruleset.test' => { 15 | 'rules' => [ 16 | { 17 | action => { 18 | 'name' => 'action.test', 19 | 'type' => 'omfile', 20 | 'config' => { 21 | 'queue.type' => 'LinkedList', 22 | 'queue.spoolDirectory' => '/var/log/rsyslog/queue', 23 | 'file' => '/tmp/error_log', 24 | } 25 | }, 26 | } 27 | ] 28 | }, 29 | 'ruleset_eth0_514_test' => { 30 | 'parameters' => { 31 | 'queue.size' => '10000', 32 | }, 33 | 'rules' => [ 34 | { 35 | 'property_filter' => { 36 | 'property' => 'msg', 37 | 'operator' => 'contains', 38 | 'value' => 'error', 39 | 'tasks' => [ 40 | { 'call' => 'action.ruleset.test' }, 41 | { 'stop' => true } 42 | ] 43 | } 44 | } 45 | ] 46 | } 47 | } 48 | } 49 | MANIFEST 50 | 51 | apply_manifest(pp, catch_failures: true) 52 | apply_manifest(pp, catch_changes: true) 53 | end 54 | 55 | describe file('/etc/rsyslog.d/50_rsyslog.conf') do 56 | it { is_expected.to be_file } 57 | it { is_expected.to be_readable } 58 | its(:content) { is_expected.to match(%r{# ruleset_eth0_514_test ruleset\nruleset \(name="ruleset_eth0_514_test"\n\s*queue\.size="10000"\n\) {\n# Property-based Filter\n:msg, contains, "error" {\n call action\.ruleset\.test\n stop\n\s*}\n\n}}) } 59 | end 60 | end 61 | -------------------------------------------------------------------------------- /spec/classes/init_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog', include_rsyslog: true do 6 | on_supported_os.each do |os, facts| 7 | context "on #{os}" do 8 | let(:facts) { facts } 9 | 10 | context 'with defaults for all parameters' do 11 | it { is_expected.to contain_class('rsyslog') } 12 | it { is_expected.to contain_class('rsyslog::base') } 13 | end 14 | 15 | describe 'Rsyslog::Base' do 16 | context 'with defaults' do 17 | it { is_expected.to contain_package('rsyslog').with_ensure('installed') } 18 | it { is_expected.to contain_file('/etc/rsyslog.d').with_ensure('directory').that_requires('Package[rsyslog]') } 19 | it { is_expected.to contain_file('/etc/rsyslog.conf').with_ensure('file') } 20 | it { is_expected.to contain_service('rsyslog').with_ensure('running').with_enable(true) } 21 | end 22 | 23 | context 'with package not managed' do 24 | let(:params) { { 'manage_package' => false } } 25 | 26 | it { is_expected.not_to contain_package('rsyslog') } 27 | end 28 | 29 | context 'with feature packages' do 30 | let(:params) { { 'feature_packages' => %w[rsyslog-relp rsyslog-mmnormalize rsyslog-gnutls] } } 31 | 32 | it { is_expected.to contain_package('rsyslog-relp').with_ensure('installed') } 33 | it { is_expected.to contain_package('rsyslog-mmnormalize').with_ensure('installed') } 34 | it { is_expected.to contain_package('rsyslog-gnutls').with_ensure('installed') } 35 | end 36 | 37 | context "with upstream packages enabled on #{facts[:os]['name']}" do 38 | let(:params) { { 'use_upstream_repo' => true } } 39 | 40 | case facts[:os]['family'] 41 | when 'Debian' 42 | it { is_expected.to contain_apt__ppa('ppa:adiscon/v8-stable') } if facts[:os]['name'] == 'Ubuntu' 43 | when 'RedHat' 44 | it { is_expected.to contain_yumrepo('upstream_rsyslog') } if facts[:os]['release']['major'].to_i < 9 45 | end 46 | end 47 | 48 | context 'with manage_confdir disabled' do 49 | let(:params) { { 'manage_confdir' => false } } 50 | 51 | it { is_expected.not_to contain_file('/etc/rsyslog.d') } 52 | end 53 | 54 | context 'with override_default_config disabled' do 55 | let(:params) { { 'override_default_config' => false } } 56 | 57 | it { is_expected.not_to contain_file('/etc/rsyslog.conf') } 58 | end 59 | 60 | context 'with manage_confdir and manage_service' do 61 | let(:params) do 62 | { 63 | 'manage_service' => true, 64 | 'manage_confdir' => true, 65 | } 66 | end 67 | 68 | it 'manages the rsyslog directory and restarts a service' do 69 | is_expected.to contain_file('/etc/rsyslog.d'). 70 | with_ensure('directory'). 71 | with_purge(true). 72 | that_notifies('Service[rsyslog]') 73 | end 74 | end 75 | 76 | context 'with service disabled' do 77 | let(:params) { { 'manage_service' => false } } 78 | 79 | it { is_expected.not_to contain_service('rsyslog') } 80 | end 81 | end 82 | end 83 | end 84 | end 85 | -------------------------------------------------------------------------------- /spec/defines/component/action_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | require 'yaml' 5 | 6 | describe 'Rsyslog::Component::Action', include_rsyslog: true do 7 | on_supported_os.each do |os, os_facts| 8 | context "on #{os}" do 9 | let :facts do 10 | os_facts 11 | end 12 | 13 | let(:title) { 'myaction' } 14 | 15 | context 'default action without facility' do 16 | let(:params) do 17 | { 18 | type: 'omelasticsearch', 19 | priority: 40, 20 | target: '50_rsyslog.conf', 21 | confdir: '/etc/rsyslog.d', 22 | config: { 23 | 'queue.type' => 'linkedlist', 24 | 'queue.spoolDirectory' => '/var/log/rsyslog/queue' 25 | } 26 | } 27 | end 28 | 29 | it do 30 | is_expected.to contain_concat__fragment('rsyslog::component::action::myaction').with_content(<<~CONTENT 31 | # myaction 32 | action(type="omelasticsearch" 33 | name="myaction" 34 | queue.type="linkedlist" 35 | queue.spoolDirectory="/var/log/rsyslog/queue" 36 | ) 37 | CONTENT 38 | ) 39 | end 40 | 41 | it { is_expected.to contain_concat('/etc/rsyslog.d/50_rsyslog.conf') } 42 | it { is_expected.to contain_rsyslog__generate_concat('rsyslog::concat::action::myaction') } 43 | end 44 | 45 | context 'facility with single line action' do 46 | let(:params) do 47 | { 48 | type: 'omfile', 49 | priority: 40, 50 | target: '50_rsyslog.conf', 51 | confdir: '/etc/rsyslog.d', 52 | facility: 'kern.*', 53 | config: { 54 | 'dynaFile' => 'remoteKern' 55 | } 56 | } 57 | end 58 | 59 | it do 60 | is_expected.to contain_concat__fragment('rsyslog::component::action::myaction').with_content(%r{# myaction\n.*kern\.\*.*action\(type="omfile".*dynaFile="remoteKern".*\)}) 61 | end 62 | end 63 | 64 | context 'facility with multiline action' do 65 | let(:params) do 66 | { 67 | type: 'omelasticsearch', 68 | priority: 40, 69 | target: '50_rsyslog.conf', 70 | confdir: '/etc/rsyslog.d', 71 | facility: '*.*', 72 | config: { 73 | 'template' => 'plain-syslog', 74 | 'searchIndex' => 'logstash-index', 75 | 'queue.type' => 'linkedlist', 76 | 'queue.spoolDirectory' => '/var/log/rsyslog/queue', 77 | 'queue.filename' => 'dbq', 78 | 'queue.maxdiskspace' => '100g', 79 | 'queue.maxfilesize' => '100m', 80 | 'queue.SaveOnShutdown' => 'on', 81 | 'server' => 'logstash.domain.local', 82 | 'action.resumeretrycount' => '-1', 83 | 'bulkmode' => 'on', 84 | 'dynSearchIndex' => 'on' 85 | } 86 | } 87 | end 88 | 89 | it do 90 | is_expected.to contain_concat__fragment('rsyslog::component::action::myaction').with_content( 91 | %r{# myaction\n.*\*\.\*.*action\(type="omelasticsearch".*\n.*template="plain-syslog".*\n.*searchIndex="logstash-index".*\n.*queue.type="linkedlist".*\n.*queue.spoolDirectory="/var/log/rsyslog/queue".*\n.*queue.filename="dbq".*\n.*queue.maxdiskspace="100g".*\n.*queue.maxfilesize="100m".*\n.*queue.SaveOnShutdown="on".*\n.*server="logstash.domain.local".*\n.*action.resumeretrycount="-1".*\n.*bulkmode="on".*\n.*dynSearchIndex="on".*\n.*\)} 92 | ) 93 | end 94 | end 95 | end 96 | end 97 | end 98 | -------------------------------------------------------------------------------- /spec/defines/component/expression_filter_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | require 'yaml' 5 | 6 | describe 'rsyslog::component::expression_filter', include_rsyslog: true do 7 | on_supported_os.each do |os, os_facts| 8 | context "on #{os}" do 9 | let :facts do 10 | os_facts 11 | end 12 | 13 | let(:title) { 'myexpressionfilter' } 14 | 15 | context 'initial test' do 16 | let(:params) do 17 | { 18 | priority: 55, 19 | target: '50_rsyslog.conf', 20 | confdir: '/etc/rsyslog.d', 21 | conditionals: { 22 | if: { 23 | expression: 'msg == "test"', 24 | tasks: [ 25 | { action: { 26 | name: 'myaction', 27 | type: 'omfile', 28 | config: { 29 | dynaFile: 'remoteSyslog' 30 | } 31 | } } 32 | ] 33 | }, 34 | else: { 35 | tasks: [ 36 | { action: { 37 | name: 'myaction2', 38 | type: 'omfwd', 39 | config: { 40 | KeepAlive: 'on' 41 | } 42 | } } 43 | ] 44 | } 45 | } 46 | } 47 | end 48 | 49 | it do 50 | is_expected.to contain_concat__fragment('rsyslog::component::expression_filter::myexpressionfilter').with_content( 51 | <<~CONTENT 52 | # myexpressionfilter 53 | if msg == "test" then { 54 | # myaction 55 | action(type="omfile" 56 | name="myaction" 57 | dynaFile="remoteSyslog" 58 | ) 59 | 60 | } 61 | else { 62 | # myaction2 63 | action(type="omfwd" 64 | name="myaction2" 65 | KeepAlive="on" 66 | ) 67 | 68 | } 69 | CONTENT 70 | ) 71 | end 72 | 73 | it { is_expected.to contain_class('rsyslog') } 74 | it { is_expected.to contain_concat('/etc/rsyslog.d/50_rsyslog.conf') } 75 | it { is_expected.to contain_rsyslog__generate_concat('rsyslog::concat::expression_filter::myexpressionfilter') } 76 | end 77 | end 78 | end 79 | end 80 | -------------------------------------------------------------------------------- /spec/defines/component/global_config_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | require 'yaml' 5 | 6 | describe 'rsyslog::component::global_config', include_rsyslog: true do 7 | on_supported_os.each do |os, os_facts| 8 | context "on #{os}" do 9 | let :facts do 10 | os_facts 11 | end 12 | 13 | let(:title) { 'configoption' } 14 | 15 | context 'when configuring a legacy type value' do 16 | let(:params) do 17 | { 18 | type: 'legacy', 19 | value: 'on', 20 | priority: 40, 21 | target: '50_rsyslog.conf', 22 | confdir: '/etc/rsyslog.d' 23 | } 24 | end 25 | 26 | it do 27 | is_expected.to contain_concat__fragment('rsyslog::component::global_config::configoption').with_content( 28 | %r{\$configoption\son\n} 29 | ) 30 | end 31 | 32 | it { is_expected.to contain_class('rsyslog') } 33 | it { is_expected.to contain_concat('/etc/rsyslog.d/50_rsyslog.conf') } 34 | it { is_expected.to contain_rsyslog__generate_concat('rsyslog::concat::global_config::configoption') } 35 | end 36 | end 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /spec/defines/component/input_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | require 'yaml' 5 | 6 | describe 'rsyslog::component::input', include_rsyslog: true do 7 | on_supported_os.each do |os, os_facts| 8 | context "on #{os}" do 9 | let :facts do 10 | os_facts 11 | end 12 | 13 | let(:title) { 'myinput' } 14 | 15 | context 'string input' do 16 | let(:params) do 17 | { 18 | type: 'imudp', 19 | priority: 40, 20 | target: '50_rsyslog.conf', 21 | confdir: '/etc/rsyslog.d', 22 | config: { 23 | 'port' => '514' 24 | } 25 | } 26 | end 27 | 28 | it do 29 | is_expected.to contain_concat__fragment('rsyslog::component::input::myinput').with_content( 30 | %r{ 31 | #\smyinput 32 | \s+input\(type="imudp" 33 | \s+port="514" 34 | \s+\) 35 | }x 36 | ) 37 | end 38 | 39 | it { is_expected.to contain_class('rsyslog') } 40 | it { is_expected.to contain_concat('/etc/rsyslog.d/50_rsyslog.conf') } 41 | it { is_expected.to contain_rsyslog__generate_concat('rsyslog::concat::input::myinput') } 42 | end 43 | end 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /spec/defines/component/legacy_config_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | require 'yaml' 5 | 6 | describe 'rsyslog::component::legacy_config', include_rsyslog: true do 7 | on_supported_os.each do |os, os_facts| 8 | context "on #{os}" do 9 | let :facts do 10 | os_facts 11 | end 12 | 13 | let(:title) { 'mylegacy_rules' } 14 | 15 | context 'key/value legacy rules' do 16 | let(:params) do 17 | { 18 | priority: 40, 19 | target: '50_rsyslog.conf', 20 | confdir: '/etc/rsyslog.d', 21 | key: 'auth,authpriv.*', 22 | value: '/var/log/auth.log' 23 | } 24 | end 25 | 26 | it do 27 | is_expected.to contain_concat__fragment('rsyslog::component::legacy_config::mylegacy_rules').with_content( 28 | %r{ 29 | mylegacy_rules\n 30 | ^auth,authpriv\.\*\s+/var/log/auth.log\n 31 | }x 32 | ) 33 | end 34 | 35 | it { is_expected.to contain_class('rsyslog') } 36 | it { is_expected.to contain_concat('/etc/rsyslog.d/50_rsyslog.conf') } 37 | it { is_expected.to contain_rsyslog__generate_concat('rsyslog::concat::legacy_config::mylegacy_rules') } 38 | end 39 | 40 | context 'oneline legacy rules' do 41 | let(:params) do 42 | { 43 | priority: 40, 44 | target: '50_rsyslog.conf', 45 | confdir: '/etc/rsyslog.d', 46 | type: 'legacy', 47 | value: '*.* @@logmonster.cloud.local' 48 | } 49 | end 50 | 51 | it do 52 | is_expected.to contain_concat__fragment('rsyslog::component::legacy_config::mylegacy_rules').with_content( 53 | %r{(?x)# mylegacy_rules\n 54 | ^\*\.\*\s+@@logmonster.cloud.local\s*\n 55 | } 56 | ) 57 | end 58 | end 59 | end 60 | end 61 | end 62 | -------------------------------------------------------------------------------- /spec/defines/component/lookup_table_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | require 'yaml' 5 | 6 | describe 'rsyslog::component::lookup_table', include_rsyslog: true do 7 | on_supported_os.each do |os, os_facts| 8 | context "on #{os}" do 9 | let :facts do 10 | os_facts 11 | end 12 | 13 | let(:title) { 'mylookuptable' } 14 | 15 | context 'default lookup table example' do 16 | let(:params) do 17 | { 18 | priority: 40, 19 | target: '50_rsyslog.conf', 20 | confdir: '/etc/rsyslog.d', 21 | lookup_json: { 22 | 'version' => 1, 23 | 'nomatch' => 'unk', 24 | 'type' => 'string', 25 | 'table' => [ 26 | { 'index' => '1.1.1.1', 'value' => 'A' }, 27 | { 'index' => '2.2.2.2', 'value' => 'B' } 28 | ] 29 | }, 30 | lookup_file: '/etc/rsyslog.d/example_lookup.json', 31 | reload_on_hup: true 32 | } 33 | end 34 | 35 | it do 36 | is_expected.to contain_file('rsyslog::component::lookup_table_json::mylookuptable').with_content( 37 | File.read('spec/fixtures/test_files/example_lookup.json') 38 | ) 39 | end 40 | 41 | it do 42 | is_expected.to contain_concat__fragment('rsyslog::component::lookup_table::mylookuptable').with_content( 43 | File.read('spec/fixtures/test_files/lookup_table.conf') 44 | ) 45 | end 46 | 47 | it { is_expected.to contain_class('rsyslog') } 48 | it { is_expected.to contain_concat('/etc/rsyslog.d/50_rsyslog.conf') } 49 | it { is_expected.to contain_rsyslog__generate_concat('rsyslog::concat::lookup_table::mylookuptable') } 50 | end 51 | 52 | context 'with docker support' do 53 | let(:params) do 54 | { 55 | priority: 40, 56 | target: '50_rsyslog.conf', 57 | confdir: '/etc/rsyslog.d', 58 | lookup_json: { 59 | 'version' => 1, 60 | 'nomatch' => 'unk', 61 | 'type' => 'string', 62 | 'table' => [ 63 | { 'index' => '1.1.1.1', 'value' => 'A' }, 64 | { 'index' => '2.2.2.2', 'value' => 'B' } 65 | ] 66 | }, 67 | lookup_file: '/etc/rsyslog.d/example_lookup.json', 68 | rsyslog_in_docker: true, 69 | json_file: '/config/container/tables/example_lookup.json', 70 | reload_on_hup: true 71 | } 72 | end 73 | 74 | it do 75 | is_expected.to contain_file('rsyslog::component::lookup_table_json::mylookuptable').with_content( 76 | File.read('spec/fixtures/test_files/example_lookup.json') 77 | ) 78 | end 79 | 80 | it do 81 | is_expected.to contain_concat__fragment('rsyslog::component::lookup_table::mylookuptable').with_content( 82 | File.read('spec/fixtures/test_files/lookup_table.conf') 83 | ) 84 | end 85 | 86 | it { is_expected.to contain_class('rsyslog') } 87 | it { is_expected.to contain_concat('/etc/rsyslog.d/50_rsyslog.conf') } 88 | it { is_expected.to contain_rsyslog__generate_concat('rsyslog::concat::lookup_table::mylookuptable') } 89 | end 90 | end 91 | end 92 | end 93 | -------------------------------------------------------------------------------- /spec/defines/component/main_queue_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'rsyslog::component::main_queue', include_rsyslog: true do 6 | on_supported_os.each do |os, os_facts| 7 | context "on #{os}" do 8 | let :facts do 9 | os_facts 10 | end 11 | 12 | let(:title) { 'main_queue_opts' } 13 | 14 | let(:params) do 15 | { 16 | priority: 40, 17 | target: '50_rsyslog.conf', 18 | confdir: '/etc/rsyslog.d', 19 | config: { 20 | 'queue.maxdiskspace' => '1000G', 21 | 'queue.dequeuebatchsize' => '1000' 22 | } 23 | } 24 | end 25 | 26 | describe 'rsyslog::component::main_queue::main_queue_opts' do 27 | context 'with defaults for all parameters' do 28 | it do 29 | is_expected.to contain_concat__fragment('rsyslog::component::main_queue::main_queue_opts').with( 30 | 'target' => '/etc/rsyslog.d/50_rsyslog.conf', 31 | 'order' => 40 32 | ) 33 | end 34 | 35 | it do 36 | is_expected.to contain_concat__fragment('rsyslog::component::main_queue::main_queue_opts').with_content( 37 | %r{ 38 | main_queue\( 39 | \s+queue.maxdiskspace="1000G" 40 | \s+queue.dequeuebatchsize="1000" 41 | \s+\) 42 | }x 43 | ) 44 | end 45 | 46 | it { is_expected.to contain_class('rsyslog') } 47 | it { is_expected.to contain_concat('/etc/rsyslog.d/50_rsyslog.conf') } 48 | it { is_expected.to contain_rsyslog__generate_concat('rsyslog::concat::main_queue::main_queue_opts') } 49 | end 50 | end 51 | end 52 | end 53 | end 54 | -------------------------------------------------------------------------------- /spec/defines/component/module_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | require 'yaml' 5 | 6 | describe 'rsyslog::component::module', include_rsyslog: true do 7 | on_supported_os.each do |os, os_facts| 8 | context "on #{os}" do 9 | let :facts do 10 | os_facts 11 | end 12 | 13 | let(:title) { 'impstats' } 14 | 15 | context 'string action' do 16 | let(:params) do 17 | { 18 | type: 'external', 19 | priority: 20, 20 | target: '50_rsyslog.conf', 21 | confdir: '/etc/rsyslog.d', 22 | config: { 23 | 'interval' => '60', 24 | 'severity' => '7', 25 | 'log.syslog' => 'off', 26 | 'log.file' => '/var/log/rsyslog/logs/stats/stats.log', 27 | 'Ruleset' => 'remote' 28 | } 29 | } 30 | end 31 | 32 | it do 33 | is_expected.to contain_concat__fragment('rsyslog::component::module::impstats').with_content( 34 | %r{ 35 | module\(load="impstats" 36 | \s+interval="60" 37 | \s+severity="7" 38 | \s+log\.syslog="off" 39 | \s+log\.file="/var/log/rsyslog/logs/stats/stats.log" 40 | \s+Ruleset="remote" 41 | \s+\) 42 | }x 43 | ) 44 | end 45 | 46 | it do 47 | is_expected.to contain_concat__fragment('rsyslog::component::module::impstats').with( 48 | 'target' => '/etc/rsyslog.d/50_rsyslog.conf', 49 | 'order' => 20 50 | ) 51 | end 52 | 53 | it { is_expected.to contain_class('rsyslog') } 54 | it { is_expected.to contain_concat('/etc/rsyslog.d/50_rsyslog.conf') } 55 | it { is_expected.to contain_rsyslog__generate_concat('rsyslog::concat::module::impstats') } 56 | end 57 | end 58 | end 59 | end 60 | -------------------------------------------------------------------------------- /spec/defines/component/parser_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | require 'yaml' 5 | 6 | describe 'rsyslog::component::parser', include_rsyslog: true do 7 | on_supported_os.each do |os, os_facts| 8 | context "on #{os}" do 9 | let :facts do 10 | os_facts 11 | end 12 | 13 | let(:title) { 'pmrfc3164.hostname_with_slashes' } 14 | 15 | context 'pmrfc3164 parser' do 16 | let(:params) do 17 | { 18 | type: 'pmrfc3164', 19 | priority: 45, 20 | target: '50_rsyslog.conf', 21 | confdir: '/etc/rsyslog.d', 22 | config: { 23 | 'permit.slashesinhostname' => 'on' 24 | } 25 | } 26 | end 27 | 28 | it do 29 | is_expected.to contain_concat__fragment('rsyslog::component::parser::pmrfc3164.hostname_with_slashes').with_content( 30 | %r{ 31 | pmrfc3164.hostname_with_slashes 32 | \s+parser\(name="pmrfc3164.hostname_with_slashes" 33 | \s+type="pmrfc3164" 34 | \s+permit.slashesinhostname="on" 35 | \s+\) 36 | }x 37 | ) 38 | end 39 | 40 | it { is_expected.to contain_class('rsyslog') } 41 | it { is_expected.to contain_concat('/etc/rsyslog.d/50_rsyslog.conf') } 42 | it { is_expected.to contain_rsyslog__generate_concat('rsyslog::concat::parser::pmrfc3164.hostname_with_slashes') } 43 | end 44 | end 45 | end 46 | end 47 | -------------------------------------------------------------------------------- /spec/defines/component/property_filter_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | require 'yaml' 5 | 6 | describe 'rsyslog::component::property_filter', include_rsyslog: true do 7 | on_supported_os.each do |os, os_facts| 8 | context "on #{os}" do 9 | let :facts do 10 | os_facts 11 | end 12 | let(:title) { 'mypropertyfilter' } 13 | 14 | context 'initial test' do 15 | let(:params) do 16 | { 17 | priority: 55, 18 | target: '50_rsyslog.conf', 19 | confdir: '/etc/rsyslog.d', 20 | property: 'msg', 21 | operator: 'contains', 22 | value: 'val', 23 | tasks: [ 24 | { 25 | action: { 26 | name: 'myaction', 27 | type: 'omfile', 28 | config: { 29 | dynaFile: 'remoteSyslog' 30 | } 31 | } 32 | } 33 | ] 34 | } 35 | end 36 | 37 | it do 38 | is_expected.to contain_concat__fragment('rsyslog::component::property_filter::mypropertyfilter').with_content( 39 | <<~CONTENT 40 | # mypropertyfilter 41 | :msg, contains, "val" { 42 | # myaction 43 | action(type="omfile" 44 | name="myaction" 45 | dynaFile="remoteSyslog" 46 | ) 47 | 48 | } 49 | CONTENT 50 | ) 51 | end 52 | 53 | it { is_expected.to contain_class('rsyslog') } 54 | it { is_expected.to contain_concat('/etc/rsyslog.d/50_rsyslog.conf') } 55 | it { is_expected.to contain_rsyslog__generate_concat('rsyslog::concat::property_filter::mypropertyfilter') } 56 | end 57 | 58 | context 'with bad operator' do 59 | let(:params) do 60 | { 61 | priority: 55, 62 | target: '50_rsyslog.conf', 63 | confdir: '/etc/rsyslog.d', 64 | property: 'msg', 65 | operator: 'equals', 66 | value: 'val', 67 | tasks: [ 68 | { action: { 69 | name: 'myaction', 70 | type: 'omfile', 71 | config: { 72 | dynaFile: 'remoteSyslog' 73 | } 74 | } } 75 | ] 76 | } 77 | end 78 | 79 | it { is_expected.to compile.and_raise_error(%r{\s*Rsyslog::Component::Property_filter\[mypropertyfilter\]: parameter 'operator' expects a match for Rsyslog::PropertyOperator\s*}) } 80 | end 81 | 82 | context 'with valid operators' do 83 | operators = %w[contains !contains startswith !startswith isequal !isequal regex !regex ereregex !ereregex] 84 | operators.each do |operator| 85 | let(:params) do 86 | { 87 | priority: 55, 88 | target: '50_rsyslog.conf', 89 | confdir: '/etc/rsyslog.d', 90 | property: 'msg', 91 | operator: operator, 92 | value: 'val', 93 | tasks: [ 94 | { action: { 95 | name: 'myaction', 96 | type: 'omfile', 97 | config: { 98 | dynaFile: 'remoteSyslog' 99 | } 100 | } } 101 | ] 102 | } 103 | end 104 | 105 | it { is_expected.to compile } 106 | end 107 | end 108 | end 109 | end 110 | end 111 | -------------------------------------------------------------------------------- /spec/defines/component/template_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | require 'yaml' 5 | 6 | describe 'rsyslog::component::template', include_rsyslog: true do 7 | on_supported_os.each do |os, os_facts| 8 | context "on #{os}" do 9 | let :facts do 10 | os_facts 11 | end 12 | 13 | let(:title) { 'mytpl' } 14 | 15 | context 'string template' do 16 | let(:params) do 17 | { 18 | type: 'string', 19 | priority: 30, 20 | target: '50_rsyslog.conf', 21 | confdir: '/etc/rsyslog.d', 22 | string: '/var/log/rsyslog/logs/%fromhost-ip%/%fromhost-ip%.log' 23 | } 24 | end 25 | 26 | it do 27 | is_expected.to contain_concat__fragment('rsyslog::component::template::mytpl').with_content( 28 | %r{ 29 | template\s\(name="mytpl"\stype="string" 30 | \s+string="/var/log/rsyslog/logs/%fromhost-ip%/%fromhost-ip%.log"\s\) 31 | }x 32 | ) 33 | end 34 | 35 | it { is_expected.to contain_class('rsyslog') } 36 | it { is_expected.to contain_concat('/etc/rsyslog.d/50_rsyslog.conf') } 37 | it { is_expected.to contain_rsyslog__generate_concat('rsyslog::concat::template::mytpl') } 38 | end 39 | 40 | context 'plugin template' do 41 | let(:params) do 42 | { 43 | type: 'plugin', 44 | priority: 30, 45 | target: '50_rsyslog.conf', 46 | confdir: '/etc/rsyslog.d', 47 | plugin: 'mystringgen' 48 | } 49 | end 50 | 51 | it do 52 | is_expected.to contain_concat__fragment('rsyslog::component::template::mytpl').with_content( 53 | %r{ 54 | template\s\(name="mytpl"\stype="plugin" 55 | \s+plugin="mystringgen"\s\) 56 | }x 57 | ) 58 | end 59 | end 60 | 61 | context 'subtree template' do 62 | let(:params) do 63 | { 64 | type: 'subtree', 65 | priority: 30, 66 | target: '50_rsyslog.conf', 67 | confdir: '/etc/rsyslog.d', 68 | subtree: '$!usr!tpl2' 69 | } 70 | end 71 | 72 | it do 73 | is_expected.to contain_concat__fragment('rsyslog::component::template::mytpl').with_content( 74 | %r{ 75 | template\s\(name="mytpl"\stype="subtree" 76 | \s+subtree="\$!usr!tpl2"\s\) 77 | }x 78 | ) 79 | end 80 | end 81 | 82 | context 'template with options' do 83 | let(:params) do 84 | { 85 | type: 'string', 86 | priority: 30, 87 | target: '50_rsyslog.conf', 88 | confdir: '/etc/rsyslog.d', 89 | string: '/var/log/rsyslog/logs/%fromhost-ip%/%fromhost-ip%.log', 90 | options: { 'sql' => 'on' } 91 | } 92 | end 93 | 94 | it do 95 | is_expected.to contain_concat__fragment('rsyslog::component::template::mytpl').with_content( 96 | %r{ 97 | template\s\(name="mytpl"\stype="string" 98 | \s+string="/var/log/rsyslog/logs/%fromhost-ip%/%fromhost-ip%.log" 99 | \s+option\.sql="on"\) 100 | }x 101 | ) 102 | end 103 | end 104 | 105 | context 'list template' do 106 | let(:params) do 107 | { 108 | type: 'list', 109 | priority: 30, 110 | target: '50_rsyslog.conf', 111 | confdir: '/etc/rsyslog.d', 112 | list_descriptions: [ 113 | { 'constant' => { 'value' => '{' } }, 114 | { 'constant' => { 'value' => '\"@timestamp\":\"' } }, 115 | { 'property' => { 'name' => 'timereported', 'dateformat' => 'rfc3339' } }, 116 | { 'constant' => { 'value' => '\"}' } }, 117 | { 'constant' => { 'value' => '\"message\\":\"' }, 'property' => { 'name' => 'msg', 'format' => 'json' } } 118 | ] 119 | } 120 | end 121 | 122 | it do 123 | is_expected.to contain_concat__fragment('rsyslog::component::template::mytpl').with_content( 124 | %r{template\s\(name="mytpl"\stype="list"\s\) 125 | \s+\{ 126 | \s+constant\(value="\{"\s\) 127 | \s+constant\(value="\\"@timestamp\\":\\""\s\) 128 | \s+property\(name="timereported"\s+dateformat="rfc3339"\s\) 129 | \s+constant\(value="\\"\}"\s\) 130 | \s+constant\(value="\\"message\\":\\""\s\)\s+property\(name="msg"\s+format="json"\s\) 131 | }x 132 | ) 133 | end 134 | end 135 | end 136 | end 137 | end 138 | -------------------------------------------------------------------------------- /spec/defines/generate_concat_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Generate_concat', include_rsyslog: true do 6 | context 'default' do 7 | let(:pre_condition) { 'include rsyslog' } 8 | let(:title) { 'mygeneratedconcat' } 9 | 10 | on_supported_os.each do |os, os_facts| 11 | context "on #{os}" do 12 | let :facts do 13 | os_facts 14 | end 15 | 16 | let(:params) do 17 | { 18 | confdir: '/etc/rsyslog.d', 19 | target: '50-rsyslog.conf' 20 | } 21 | end 22 | 23 | it 'contains rsyslog config with syslog service notification' do 24 | is_expected.to contain_concat('/etc/rsyslog.d/50-rsyslog.conf').that_notifies('Service[rsyslog]') 25 | end 26 | end 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /spec/fixtures/test_files/example_lookup.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "nomatch": "unk", 4 | "type": "string", 5 | "table": [ 6 | { 7 | "index": "1.1.1.1", 8 | "value": "A" 9 | }, 10 | { 11 | "index": "2.2.2.2", 12 | "value": "B" 13 | } 14 | ] 15 | } -------------------------------------------------------------------------------- /spec/fixtures/test_files/lookup_table.conf: -------------------------------------------------------------------------------- 1 | # mylookuptable 2 | lookup_table(name="mylookuptable" file="/etc/rsyslog.d/example_lookup.json" reloadOnHUP="on") 3 | -------------------------------------------------------------------------------- /spec/setup_acceptance_node.pp: -------------------------------------------------------------------------------- 1 | # Facter < 4 needs lsb-release for os.distro.codename 2 | if versioncmp($facts['facterversion'], '4.0.0') < 0 and $facts['os']['family'] == 'Debian' { 3 | package { 'lsb-release': 4 | ensure => 'installed', 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Managed by modulesync - DO NOT EDIT 4 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 5 | 6 | # puppetlabs_spec_helper will set up coverage if the env variable is set. 7 | # We want to do this if lib exists and it hasn't been explicitly set. 8 | ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../lib', __dir__)) 9 | 10 | require 'voxpupuli/test/spec_helper' 11 | 12 | RSpec.configure do |c| 13 | c.facterdb_string_keys = false 14 | end 15 | 16 | add_mocked_facts! 17 | 18 | if File.exist?(File.join(__dir__, 'default_module_facts.yml')) 19 | facts = YAML.safe_load(File.read(File.join(__dir__, 'default_module_facts.yml'))) 20 | facts&.each do |name, value| 21 | add_custom_fact name.to_sym, value 22 | end 23 | end 24 | Dir['./spec/support/spec/**/*.rb'].sort.each { |f| require f } 25 | -------------------------------------------------------------------------------- /spec/spec_helper_acceptance.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'voxpupuli/acceptance/spec_helper_acceptance' 4 | 5 | configure_beaker do |host| 6 | host.install_package('software-properties-common') if fact_on(host, 'os.name') == 'Ubuntu' 7 | end 8 | 9 | def cleanup_helper 10 | pp = <<-CLEANUP_MANIFEST 11 | package { 'rsyslog-logrotate': ensure => absent } 12 | package { 'rsyslog': ensure => absent } 13 | file { '/etc/rsyslog.d': ensure => absent, purge => true, force => true } 14 | file { '/etc/rsyslog.conf': ensure => absent } 15 | CLEANUP_MANIFEST 16 | 17 | apply_manifest(pp, catch_failures: true) 18 | end 19 | 20 | def upstream_cleanup 21 | if fact('os.name') == 'Ubuntu' # rubocop:disable Style/GuardClause 22 | pp = <<-CLEANUP_MANIFEST 23 | include ::apt 24 | apt::ppa { 'ppa:adiscon/v8-stable': ensure => absent } 25 | CLEANUP_MANIFEST 26 | 27 | apply_manifest(pp, catch_failures: true) 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /spec/type_aliases/actions/outputs/omamqp1_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Actions::Outputs::Omamqp1' do 6 | context 'with minimum valid data' do 7 | let(:data) do 8 | { 9 | host: 'localhost', 10 | target: 'amq.topic' 11 | } 12 | end 13 | 14 | it { is_expected.to allow_value(data) } 15 | end 16 | 17 | context 'with valid data' do 18 | context 'using all options' do 19 | let(:data) do 20 | { 21 | host: 'localhost', 22 | target: 'amq.topic', 23 | username: 'foo', 24 | password: 'bar', 25 | template: 'amq_template', 26 | idletimeout: 10, 27 | reconnectdelay: 30, 28 | maxretries: 2, 29 | disablesasl: 0 30 | } 31 | end 32 | 33 | it { is_expected.to allow_value(data) } 34 | end 35 | 36 | context 'using partial options' do 37 | let(:data) do 38 | { 39 | host: 'localhost', 40 | target: 'amq.topic', 41 | reconnectdelay: 30, 42 | maxretries: 2 43 | } 44 | end 45 | 46 | it { is_expected.to allow_value(data) } 47 | end 48 | end 49 | 50 | context 'with invalid data' do 51 | context 'missing required parameter' do 52 | let(:data) do 53 | { 54 | target: 'amq.topic', 55 | reconnectdelay: 30, 56 | maxretries: 2 57 | } 58 | end 59 | 60 | it { is_expected.not_to allow_value(data) } 61 | end 62 | 63 | context 'invalid data types' do 64 | let(:data) do 65 | { 66 | host: '', 67 | target: 'amq.topic', 68 | reconnectdelay: '30' 69 | } 70 | end 71 | 72 | it { is_expected.not_to allow_value(data) } 73 | end 74 | end 75 | end 76 | -------------------------------------------------------------------------------- /spec/type_aliases/actions/outputs/omelasticsearch_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Actions::Outputs::Omelasticsearch' do 6 | let(:data) do 7 | { 8 | server: 'elasticfoo', 9 | serverport: 1234, 10 | healthchecktimeout: 30, 11 | searchindex: 'bar', 12 | dynsearchindex: 'off', 13 | searchtype: 'any', 14 | dynsearchtype: 'off', 15 | pipelinename: 'baz', 16 | dynpipelinename: 'off', 17 | usehttps: 'on', 18 | timeout: '30s', 19 | template: 't_foobar', 20 | bulkmode: 'on', 21 | maxbytes: '32m', 22 | parent: 'blah', 23 | dynparent: 'off', 24 | uid: 'user', 25 | pwd: 'somepass', 26 | errorfile: '/foo/bar/error/file', 27 | 'tls.cacert' => '/foo/bar/ca.pem', 28 | 'tls.mycert' => '/foo/bar/cert.pem', 29 | 'tls.myprivkey' => '/foo/bar/key.pem', 30 | bulkid: 'bulk_template', 31 | dynbulkid: 'on', 32 | writeoperation: 'create', 33 | retryfailures: 'on', 34 | retryruleset: 'foo_ruleset', 35 | 'ratelimit.interval' => 10, 36 | 'ratelimit.burst' => 100 37 | } 38 | end 39 | 40 | context 'with valid data' do 41 | context 'full data' do 42 | it { is_expected.to allow_value(data) } 43 | end 44 | 45 | context 'full data with server array' do 46 | let(:data) { { server: %w[foo bar baz] } } 47 | 48 | it { is_expected.to allow_value(data) } 49 | end 50 | 51 | context 'testing pattern types' do 52 | context 'maxsize pattern' do 53 | %w[k K m M g G t T].each do |size| 54 | it { is_expected.to allow_value(maxbytes: "64#{size}") } 55 | end 56 | end 57 | 58 | context 'timeout pattern' do 59 | %w[ms s m].each do |unit| 60 | it { is_expected.to allow_value(timeout: "10#{unit}") } 61 | end 62 | end 63 | end 64 | end 65 | 66 | context 'with invalid data' do 67 | context 'bad strings' do 68 | let(:bad_data) do 69 | { 70 | server: false, 71 | searchindex: 10, 72 | searchtype: false, 73 | pipelinename: 40, 74 | template: true, 75 | parent: false, 76 | uid: 10, 77 | pwd: 400, 78 | bulkid: 30, 79 | retryruleset: true 80 | } 81 | end 82 | 83 | it { is_expected.not_to allow_value(bad_data) } 84 | end 85 | 86 | context 'bad numbers' do 87 | let(:bad_data) do 88 | { 89 | serverport: '80', 90 | healthchecktimeout: '30', 91 | 'ratelimit.interval' => '100', 92 | 'ratelimit.burst' => '30' 93 | } 94 | end 95 | 96 | it { is_expected.not_to allow_value(bad_data) } 97 | end 98 | 99 | context 'invalid paths' do 100 | let(:bad_data) do 101 | { 102 | errorfile: 'testing/path', 103 | 'tls.cacert' => 'ca.pem', 104 | 'tls.mycert' => 'cert.pem', 105 | 'tls.myprivkey' => 'key.pem' 106 | } 107 | end 108 | 109 | it { is_expected.not_to allow_value(bad_data) } 110 | end 111 | 112 | context 'invalid enumerators' do 113 | let(:bad_data) do 114 | { 115 | dynsearchindex: false, 116 | dynsearchtype: true, 117 | dynpipelinename: false, 118 | asyncrepl: false, 119 | usehttps: true, 120 | bulkmode: false, 121 | dynparent: true, 122 | dynbulkid: false, 123 | writeoperation: 'delete', 124 | retryfailures: false 125 | } 126 | end 127 | 128 | it { is_expected.not_to allow_value(bad_data) } 129 | end 130 | end 131 | end 132 | -------------------------------------------------------------------------------- /spec/type_aliases/actions/outputs/omfile_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Actions::Outputs::Omfile' do 6 | let(:data) do 7 | { 8 | file: '/var/log/file.log', 9 | dynafile: 'filename', 10 | template: 't_omfile', 11 | closetimeout: 15_000, 12 | dynafilecachesize: 512, 13 | ziplevel: 0, 14 | veryrobustzip: 'off', 15 | flushinterval: 600, 16 | asyncwriting: 'on', 17 | flushontxend: 'off', 18 | iobuffersize: '64M', 19 | dirowner: 'root', 20 | dirownernum: 0, 21 | dirgroup: 'root', 22 | dirgroupnum: 0, 23 | fileowner: 'root', 24 | fileownernum: 0, 25 | filegroup: 'root', 26 | filegroupnum: 0, 27 | filecreatemode: '0600', 28 | dircreatemode: '0700', 29 | failonchownfailure: 'on', 30 | createdirs: 'on', 31 | sync: 'on', 32 | 'sig.provider' => 'ksi_ls12', 33 | 'cry.provider' => 'gcry' 34 | } 35 | end 36 | 37 | context 'with valid data' do 38 | context 'full data' do 39 | it { is_expected.to allow_value(data) } 40 | end 41 | 42 | context 'individual parameters' do 43 | it 'is valid' do 44 | data.each do |param, value| 45 | expected_param = { param.to_sym => value } 46 | is_expected.to allow_value(expected_param) 47 | end 48 | end 49 | end 50 | end 51 | 52 | context 'with invalid data' do 53 | context 'bad strings' do 54 | let(:bad_strings) do 55 | { 56 | dynafile: '', 57 | template: false, 58 | veryrobustzip: true, 59 | asyncwriting: 'true', 60 | flushontxend: false, 61 | iobuffersize: 512, 62 | dirowner: 0, 63 | dirgroup: 0, 64 | fileowner: 0, 65 | filegroup: 0, 66 | filecreatemode: '+rwx', 67 | dircreatemode: '+rwx', 68 | failonchownfailure: true, 69 | createdirs: true, 70 | sync: true, 71 | 'sig.provider' => 'foo', 72 | 'cry.provider' => 'bar' 73 | } 74 | end 75 | 76 | it { is_expected.not_to allow_value(bad_strings) } 77 | end 78 | 79 | context 'bad integers' do 80 | let(:bad_int) do 81 | { 82 | closetimeout: '600', 83 | dynafilecachesize: '15M', 84 | ziplevel: 'tarball', 85 | flushinterval: '15s', 86 | dirownernum: '0', 87 | dirgroupnum: '0', 88 | fileownernum: '0', 89 | filegroupnum: '0' 90 | } 91 | end 92 | 93 | it { is_expected.not_to allow_value(bad_int) } 94 | end 95 | 96 | context 'bad path' do 97 | let(:bad_path) { { file: 'file' } } 98 | 99 | it { is_expected.not_to allow_value(bad_path) } 100 | end 101 | end 102 | end 103 | -------------------------------------------------------------------------------- /spec/type_aliases/actions/outputs/omfwd_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Actions::Outputs::Omfwd' do 6 | let(:data) do 7 | { 8 | target: '192.168.100.50', 9 | port: 514, 10 | protocol: 'tcp', 11 | networknamespace: 'foo', 12 | address: '192.168.100.51', 13 | ipfreebind: 0, 14 | device: 'eth0', 15 | tcp_framing: 'traditional', 16 | tcp_framedelimiter: 152, 17 | ziplevel: 0, 18 | 'compression.mode' => 'none', 19 | 'compression.stream.flushontxend' => 'off', 20 | rebindinterval: 600, 21 | keepalive: 'on', 22 | 'keepalive.probes' => 0, 23 | 'keepalive.interval' => 300, 24 | 'keepalive.time' => 0, 25 | streamdriver: 'tcp', 26 | streamdrivermode: 0, 27 | streamdriverauthmode: 'foo', 28 | streamdriverpermittedpeers: 'bar', 29 | resendlastmsgonreconnect: 'on', 30 | 'udp.sendtoall' => 'off', 31 | 'udp.senddelay' => 15, 32 | gnutlsprioritystring: 'baz' 33 | } 34 | end 35 | 36 | context 'with valid data' do 37 | context 'full data' do 38 | it { is_expected.to allow_value(data) } 39 | end 40 | 41 | context 'individual parameters' do 42 | it 'is valid' do 43 | data.each do |param, value| 44 | expected_param = { param.to_sym => value } 45 | is_expected.to allow_value(expected_param) 46 | end 47 | end 48 | end 49 | end 50 | 51 | context 'with invalid data' do 52 | context 'bad strings' do 53 | let(:bad_strings) do 54 | { 55 | protocol: 'foo', 56 | networknamespace: '', 57 | device: '', 58 | tcp_framing: 'bar', 59 | 'compression.mode' => 'double', 60 | 'compression.stream.flushontxend' => true, 61 | keepalive: false, 62 | streamdriver: 'udp', 63 | streamdriverauthmode: '', 64 | streamdriverpermittedpeers: '', 65 | resendlastmsgonreconnect: true, 66 | 'udp.sendtoall' => false, 67 | gnutlsprioritystring: '' 68 | } 69 | end 70 | 71 | it { is_expected.not_to allow_value(bad_strings) } 72 | end 73 | 74 | context 'bad integers' do 75 | let(:bad_int) do 76 | { 77 | port: '600', 78 | ipfreebind: '0', 79 | tcp_framedelimiter: 600, 80 | ziplevel: 10, 81 | rebindinterval: '15s', 82 | 'keepalive.probes' => '10', 83 | 'keepalive.interval' => '30s', 84 | 'keepalive.time' => '0', 85 | streamdrivermode: '0', 86 | 'udp.senddelay' => '30m' 87 | } 88 | end 89 | 90 | it { is_expected.not_to allow_value(bad_int) } 91 | end 92 | 93 | context 'bad ip address' do 94 | let(:bad_ip) do 95 | { 96 | target: '300.122.32.40', 97 | address: '400.152.24.666' 98 | } 99 | end 100 | 101 | it { is_expected.not_to allow_value(bad_ip) } 102 | end 103 | end 104 | end 105 | -------------------------------------------------------------------------------- /spec/type_aliases/actions/outputs/omhiredis_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Actions::Outputs::Omhiredis' do 6 | let(:data) do 7 | { 8 | server: 'localhost', 9 | serverport: 80, 10 | serverpassword: 'foo', 11 | mode: 'queue', 12 | template: 't_redis', 13 | key: 'main', 14 | userpush: 'off' 15 | } 16 | end 17 | 18 | context 'with valid data' do 19 | context 'full data' do 20 | it { is_expected.to allow_value(data) } 21 | end 22 | 23 | context 'individual parameters' do 24 | it 'is valid' do 25 | data.each do |param, value| 26 | expected_param = { param.to_sym => value } 27 | is_expected.to allow_value(expected_param) 28 | end 29 | end 30 | end 31 | end 32 | 33 | context 'with invalid data' do 34 | context 'bad strings' do 35 | let(:bad_strings) do 36 | { 37 | serverpassword: '', 38 | mode: 'user', 39 | template: '', 40 | key: '', 41 | userpush: true 42 | } 43 | end 44 | 45 | it { is_expected.not_to allow_value(bad_strings) } 46 | end 47 | 48 | context 'bad integers' do 49 | let(:bad_int) do 50 | { 51 | serverport: '80' 52 | } 53 | end 54 | 55 | it { is_expected.not_to allow_value(bad_int) } 56 | end 57 | 58 | context 'bad ip address' do 59 | let(:bad_ip) do 60 | { 61 | server: '300.122.32.' 62 | } 63 | end 64 | 65 | it { is_expected.not_to allow_value(bad_ip) } 66 | end 67 | end 68 | end 69 | -------------------------------------------------------------------------------- /spec/type_aliases/actions/outputs/omhttpfs_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Actions::Outputs::Omhttpfs' do 6 | let(:data) do 7 | { 8 | host: 'localhost', 9 | port: 443, 10 | user: 'root', 11 | https: 'on', 12 | file: 'file', 13 | isdynfile: 'off', 14 | template: 't_http' 15 | } 16 | end 17 | 18 | context 'with valid data' do 19 | context 'full data' do 20 | it { is_expected.to allow_value(data) } 21 | end 22 | 23 | context 'individual parameters' do 24 | it 'is valid' do 25 | data.each do |param, value| 26 | expected_param = { param.to_sym => value } 27 | expected_param[:file] = 'file' unless param.to_s == 'file' 28 | is_expected.to allow_value(expected_param) 29 | end 30 | end 31 | end 32 | end 33 | 34 | context 'with invalid data' do 35 | context 'bad strings' do 36 | let(:bad_strings) do 37 | { 38 | user: 0, 39 | https: false, 40 | file: '', 41 | isdynfile: true, 42 | template: '' 43 | } 44 | end 45 | 46 | it { is_expected.not_to allow_value(bad_strings) } 47 | end 48 | 49 | context 'bad integers' do 50 | let(:bad_int) do 51 | { 52 | port: '80' 53 | } 54 | end 55 | 56 | it { is_expected.not_to allow_value(bad_int) } 57 | end 58 | 59 | context 'bad ip address' do 60 | let(:bad_ip) do 61 | { 62 | host: '300.122.32.' 63 | } 64 | end 65 | 66 | it { is_expected.not_to allow_value(bad_ip) } 67 | end 68 | end 69 | end 70 | -------------------------------------------------------------------------------- /spec/type_aliases/actions/outputs/omjoural_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Actions::Outputs::Omjournal' do 6 | let(:data) do 7 | { 8 | template: 't_redis' 9 | } 10 | end 11 | 12 | context 'with valid data' do 13 | context 'full data' do 14 | it { is_expected.to allow_value(data) } 15 | end 16 | end 17 | 18 | context 'with invalid data' do 19 | context 'bad strings' do 20 | let(:bad_strings) do 21 | { 22 | template: '' 23 | } 24 | end 25 | 26 | it { is_expected.not_to allow_value(bad_strings) } 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /spec/type_aliases/actions/outputs/omkafka_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Actions::Outputs::Omkafka' do 6 | let(:data) do 7 | { 8 | broker: 'foo', 9 | topic: 'default', 10 | key: 'primary', 11 | dynatopic: 'off', 12 | 'dynatopic.cachesize' => 512, 13 | 'partitions.auto' => 'off', 14 | 'partitions.number' => 10, 15 | 'partitions.usefixed' => 0, 16 | errorfile: 'error.log', 17 | confparam: %w[param1 param2], 18 | topicconfparam: %w[param1 param2], 19 | template: 't_kafka', 20 | closetimeout: 600, 21 | resubmitonfailure: 'on', 22 | keepfailedmessages: 'off', 23 | failedmsgfile: 'message' 24 | } 25 | end 26 | 27 | context 'with valid data' do 28 | context 'full data' do 29 | it { is_expected.to allow_value(data) } 30 | end 31 | 32 | context 'individual parameters' do 33 | it 'is valid' do 34 | data.each do |param, value| 35 | expected_param = { param.to_sym => value } 36 | expected_param[:topic] = 'topic' unless param.to_s == 'topic' 37 | is_expected.to allow_value(expected_param) 38 | end 39 | end 40 | end 41 | end 42 | 43 | context 'with invalid data' do 44 | context 'bad strings' do 45 | let(:bad_strings) do 46 | { 47 | broker: '', 48 | topic: 1, 49 | key: 4, 50 | dynatopic: true, 51 | 'partitions.auto' => false, 52 | errorfile: '', 53 | confparam: [0, 1], 54 | topicconfparam: [0, 1], 55 | template: '', 56 | resubmitonfailure: false, 57 | keepfailedmessages: true, 58 | failedmsgfile: '' 59 | } 60 | end 61 | 62 | it { is_expected.not_to allow_value(bad_strings) } 63 | end 64 | 65 | context 'bad integers' do 66 | let(:bad_int) do 67 | { 68 | 'dynatopic.cachesize' => '50m', 69 | 'partitions.number' => '50', 70 | 'partitions.usefixed' => '0', 71 | closetimeout: '5h' 72 | } 73 | end 74 | 75 | it { is_expected.not_to allow_value(bad_int) } 76 | end 77 | 78 | context 'bad array' do 79 | let(:bad_array) do 80 | { 81 | confparam: 'param1', 82 | topicconfparam: 'param2' 83 | } 84 | end 85 | 86 | it { is_expected.not_to allow_value(bad_array) } 87 | end 88 | end 89 | end 90 | -------------------------------------------------------------------------------- /spec/type_aliases/actions/outputs/omlibdbi_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Actions::Outputs::Omlibdbi' do 6 | let(:data) do 7 | { 8 | driver: 'firebird', 9 | server: 'localhost', 10 | uid: 'user', 11 | pwd: 'password', 12 | db: 'database', 13 | template: 't_db' 14 | } 15 | end 16 | 17 | context 'with valid data' do 18 | context 'full data' do 19 | it { is_expected.to allow_value(data) } 20 | end 21 | end 22 | 23 | context 'with invalid data' do 24 | context 'bad strings' do 25 | let(:bad_strings) do 26 | { 27 | driver: 'database3', 28 | server: '300.12.3.', 29 | user: 0, 30 | pwd: '', 31 | db: 10, 32 | template: '' 33 | } 34 | end 35 | 36 | it { is_expected.not_to allow_value(bad_strings) } 37 | end 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /spec/type_aliases/actions/outputs/ommail_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Actions::Outputs::Ommail' do 6 | let(:data) do 7 | { 8 | server: 'mail.example.com', 9 | port: 25, 10 | mailfrom: 'user@example.com', 11 | mailto: 'user2@example.com', 12 | 'subject.template' => 'subject_temp', 13 | 'subject.text' => 'Test Subject', 14 | 'body.enable' => 'on', 15 | template: 't_mail' 16 | } 17 | end 18 | 19 | context 'with valid data' do 20 | context 'full data' do 21 | it { is_expected.to allow_value(data) } 22 | end 23 | end 24 | 25 | context 'with invalid data' do 26 | context 'bad strings' do 27 | let(:bad_strings) do 28 | { 29 | server: '192.16.2.', 30 | port: '80', 31 | mailfrom: 'user', 32 | mailto: 'user2', 33 | 'subject.template' => 1, 34 | 'subject.text' => '', 35 | 'body.enable' => true, 36 | template: '' 37 | } 38 | end 39 | 40 | it { is_expected.not_to allow_value(bad_strings) } 41 | end 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /spec/type_aliases/actions/outputs/ommongodb_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Actions::Outputs::Ommongodb' do 6 | let(:data) do 7 | { 8 | uristr: 'mongo://string', 9 | ssl_cert: '/var/cert/cert.pem', 10 | ssl_ca: '/var/cert/ca.pem', 11 | db: 'database', 12 | collection: 'collection', 13 | allowed_error_codes: %w[11000 47], 14 | template: 't_mongo', 15 | server: 'localhost', 16 | serverported: 57, 17 | uid: 'user', 18 | pwd: 'password' 19 | } 20 | end 21 | 22 | context 'with valid data' do 23 | context 'full data' do 24 | it { is_expected.to allow_value(data) } 25 | end 26 | 27 | context 'individual parameters' do 28 | it 'is valid' do 29 | data.each do |param, value| 30 | expected_param = { param.to_sym => value } 31 | is_expected.to allow_value(expected_param) 32 | end 33 | end 34 | end 35 | end 36 | 37 | context 'with invalid data' do 38 | context 'bad strings' do 39 | let(:bad_strings) do 40 | { 41 | uristr: '', 42 | db: 1, 43 | collection: 2, 44 | allowed_error_codes: [10, 4], 45 | template: false, 46 | uid: 0, 47 | pwd: '' 48 | } 49 | end 50 | 51 | it { is_expected.not_to allow_value(bad_strings) } 52 | end 53 | 54 | context 'bad integers' do 55 | let(:bad_int) do 56 | { 57 | serverported: '80' 58 | } 59 | end 60 | 61 | it { is_expected.not_to allow_value(bad_int) } 62 | end 63 | 64 | context 'bad ip address' do 65 | let(:bad_ip) do 66 | { 67 | server: '300.122.32.' 68 | } 69 | end 70 | 71 | it { is_expected.not_to allow_value(bad_ip) } 72 | end 73 | 74 | context 'bad path' do 75 | let(:bad_path) do 76 | { 77 | ssl_cert: 'cert.pem', 78 | ssl_ca: 'ca.pem' 79 | } 80 | end 81 | 82 | it { is_expected.not_to allow_value(bad_path) } 83 | end 84 | end 85 | end 86 | -------------------------------------------------------------------------------- /spec/type_aliases/actions/outputs/ommysql_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Actions::Outputs::Ommysql' do 6 | let(:data) do 7 | { 8 | server: 'localhost', 9 | socket: '/var/lib/mysql.sock', 10 | db: 'database', 11 | uid: 'user', 12 | pwd: 'password', 13 | serverport: 80, 14 | 'mysqlconfig.file' => '/etc/my.cnf', 15 | 'mysqlconfig.section' => 'server', 16 | template: 't_mysql' 17 | } 18 | end 19 | 20 | context 'with valid data' do 21 | context 'full data' do 22 | it { is_expected.to allow_value(data) } 23 | end 24 | 25 | context 'individual parameters' do 26 | it 'is valid' do 27 | data.each do |param, value| 28 | expected_param = { param.to_sym => value } 29 | expected_param[:server] = 'localhost' unless param.to_s == 'server' 30 | expected_param[:db] = 'database' unless param.to_s == 'db' 31 | expected_param[:uid] = 'user' unless param.to_s == 'uid' 32 | expected_param[:pwd] = 'password' unless param.to_s == 'pwd' 33 | is_expected.to allow_value(expected_param) 34 | end 35 | end 36 | end 37 | end 38 | 39 | context 'with invalid data' do 40 | context 'bad strings' do 41 | let(:bad_strings) do 42 | { 43 | server: '192.16.3.', 44 | db: 1, 45 | uid: 0, 46 | pwd: '', 47 | 'mysqlconfig.section' => 10, 48 | template: false 49 | } 50 | end 51 | 52 | it { is_expected.not_to allow_value(bad_strings) } 53 | end 54 | 55 | context 'bad integers' do 56 | let(:bad_int) do 57 | { 58 | serverport: '80' 59 | } 60 | end 61 | 62 | it { is_expected.not_to allow_value(bad_int) } 63 | end 64 | 65 | context 'bad ip address' do 66 | let(:bad_ip) do 67 | { 68 | server: '300.122.32.' 69 | } 70 | end 71 | 72 | it { is_expected.not_to allow_value(bad_ip) } 73 | end 74 | 75 | context 'bad path' do 76 | let(:bad_path) do 77 | { 78 | socket: 'my.sock', 79 | 'mysqlconfig.file' => 'my.cnf' 80 | } 81 | end 82 | 83 | it { is_expected.not_to allow_value(bad_path) } 84 | end 85 | end 86 | end 87 | -------------------------------------------------------------------------------- /spec/type_aliases/actions/outputs/ompgsql_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Actions::Outputs::Ompgsql' do 6 | context 'with minimum required valid data' do 7 | let(:data) do 8 | { 9 | db: 'database' 10 | } 11 | end 12 | 13 | context 'with server ip address' do 14 | let(:ip_data) { data.merge(server: '1.1.1.1') } 15 | 16 | it { is_expected.to allow_value(ip_data) } 17 | end 18 | 19 | context 'with server hostname' do 20 | let(:name_data) { data.merge(server: 'localhost') } 21 | 22 | it { is_expected.to allow_value(name_data) } 23 | end 24 | 25 | context 'with server fqdn' do 26 | let(:fqdn_data) { data.merge(server: 'server.example.com') } 27 | 28 | it { is_expected.to allow_value(fqdn_data) } 29 | end 30 | end 31 | 32 | context 'with full valid data' do 33 | let(:data) do 34 | { 35 | server: '1.1.1.1', 36 | port: 5432, 37 | db: 'database', 38 | user: 'postgres', 39 | pass: 'test1234', 40 | template: 'template1' 41 | } 42 | end 43 | 44 | it { is_expected.to allow_value(data) } 45 | end 46 | 47 | context 'with invalid data' do 48 | let(:base_data) do 49 | { 50 | server: '1.1.1.1', 51 | db: 'database' 52 | } 53 | end 54 | 55 | context 'bad server' do 56 | let(:invalid) { base_data.merge(server: '300.1.1.1.') } 57 | 58 | it { is_expected.not_to allow_value(invalid) } 59 | end 60 | 61 | context 'nil database' do 62 | let(:invalid) { base_data.merge(db: '') } 63 | 64 | it { is_expected.not_to allow_value(invalid) } 65 | end 66 | 67 | context 'invalid port' do 68 | let(:invalid) { base_data.merge(port: 100_000) } 69 | 70 | it { is_expected.not_to allow_value(invalid) } 71 | end 72 | 73 | context 'invalid user' do 74 | let(:invalid) { base_data.merge(user: '') } 75 | 76 | it { is_expected.not_to allow_value(invalid) } 77 | end 78 | 79 | context 'invalid pass' do 80 | let(:invalid) { base_data.merge(pass: '') } 81 | 82 | it { is_expected.not_to allow_value(invalid) } 83 | end 84 | 85 | context 'invalid template' do 86 | let(:invalid) { base_data.merge(template: '') } 87 | 88 | it { is_expected.not_to allow_value(invalid) } 89 | end 90 | end 91 | end 92 | -------------------------------------------------------------------------------- /spec/type_aliases/actions/outputs/ompipe_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Actions::Outputs::Ompipe' do 6 | let(:data) do 7 | { 8 | pipe: 'pipe' 9 | } 10 | end 11 | 12 | context 'with valid data' do 13 | context 'full data' do 14 | it { is_expected.to allow_value(data) } 15 | end 16 | end 17 | 18 | context 'with invalid data' do 19 | context 'bad strings' do 20 | let(:bad_strings) do 21 | { 22 | pipe: '' 23 | } 24 | end 25 | 26 | it { is_expected.not_to allow_value(bad_strings) } 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /spec/type_aliases/actions/outputs/omprog_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Actions::Outputs::Omprog' do 6 | let(:data) do 7 | { 8 | template: 't_prog', 9 | binary: '/usr/bin/cat', 10 | confirmmessages: 'on', 11 | confirmtimeout: 300, 12 | reportfailures: 'on', 13 | usetransactions: 'off', 14 | begintransactionmark: 'start', 15 | committransactionmark: 'commit', 16 | output: '/var/log/prog/output.log', 17 | filecreatemode: '0644', 18 | 'hup.signal' => 'USR1', 19 | signalonclose: 'on', 20 | closetimeout: 120, 21 | killunresponsive: 'on', 22 | forcesingleinstance: 'off' 23 | } 24 | end 25 | 26 | context 'with valid data' do 27 | context 'full data' do 28 | it { is_expected.to allow_value(data) } 29 | end 30 | 31 | context 'individual parameters' do 32 | it 'is valid' do 33 | data.each do |param, value| 34 | expected_param = { param.to_sym => value } 35 | expected_param[:binary] = '/usr/bin/cat' unless param.to_s == 'binary' 36 | is_expected.to allow_value(expected_param) 37 | end 38 | end 39 | end 40 | end 41 | 42 | context 'with invalid data' do 43 | context 'bad strings' do 44 | let(:bad_strings) do 45 | { 46 | binary: '/usr/bin/cat', 47 | template: false, 48 | confirmmessages: true, 49 | reportfailures: false, 50 | usetransactions: true, 51 | begintransactionmark: 10, 52 | committransactionmark: false, 53 | filecreatemode: '+rwx', 54 | 'hup.signal' => 'foo', 55 | signalonclose: false, 56 | killunresponsive: false, 57 | forcesingleinstance: true 58 | } 59 | end 60 | 61 | it { is_expected.not_to allow_value(bad_strings) } 62 | end 63 | 64 | context 'bad integers' do 65 | let(:bad_int) do 66 | { 67 | binary: '/usr/bin/cat', 68 | confirmtimeout: '10m', 69 | closetimeout: '1h' 70 | } 71 | end 72 | 73 | it { is_expected.not_to allow_value(bad_int) } 74 | end 75 | 76 | context 'bad path' do 77 | let(:bad_path) do 78 | { 79 | binary: 'cat', 80 | output: 'output.log' 81 | } 82 | end 83 | 84 | it { is_expected.not_to allow_value(bad_path) } 85 | end 86 | end 87 | end 88 | -------------------------------------------------------------------------------- /spec/type_aliases/actions/outputs/omrelp_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Actions::Outputs::Omrelp' do 6 | let(:data) do 7 | { 8 | target: '10.1.1.25', 9 | port: 514, 10 | template: 't_relp', 11 | timeout: 300, 12 | 'conn.timeout' => 60, 13 | rebindinterval: 30, 14 | windowsize: 10, 15 | tls: 'on', 16 | 'tls.compression' => 'off', 17 | 'tls.permittedpeer' => %w[host1 host2 host3], 18 | 'tls.automode' => 'name', 19 | 'tls.cacert' => '/var/cert/ca.pem', 20 | 'tls.mycert' => '/var/cert/cert.pem', 21 | 'tls.myprivkey' => '/var/cert/key.pem', 22 | 'tls.prioritystring' => 'urgent', 23 | localclientip: '192.168.1.1' 24 | } 25 | end 26 | 27 | context 'with valid data' do 28 | context 'full data' do 29 | it { is_expected.to allow_value(data) } 30 | end 31 | 32 | context 'individual parameters' do 33 | it 'is valid' do 34 | data.each do |param, value| 35 | expected_param = { param.to_sym => value } 36 | expected_param[:target] = 'localhost' unless param.to_s == 'target' 37 | is_expected.to allow_value(expected_param) 38 | end 39 | end 40 | end 41 | end 42 | 43 | context 'with invalid data' do 44 | context 'bad strings' do 45 | let(:bad_strings) do 46 | { 47 | template: true, 48 | tls: false, 49 | 'tls.compression' => true, 50 | 'tls.permittedpeer' => [0, 1, 2], 51 | 'tls.automode' => 'foo', 52 | 'tls.prioritystring' => 10 53 | } 54 | end 55 | 56 | it { is_expected.not_to allow_value(bad_strings) } 57 | end 58 | 59 | context 'bad integers' do 60 | let(:bad_int) do 61 | { 62 | port: '600', 63 | timeout: '300', 64 | 'conn.timeout' => '10s', 65 | rebindinterval: '5m', 66 | windowsize: '50' 67 | } 68 | end 69 | 70 | it { is_expected.not_to allow_value(bad_int) } 71 | end 72 | 73 | context 'bad ip address' do 74 | let(:bad_ip) do 75 | { 76 | target: '300.122.32.', 77 | localclientip: '192.233..1' 78 | } 79 | end 80 | 81 | it { is_expected.not_to allow_value(bad_ip) } 82 | end 83 | 84 | context 'bad path' do 85 | let(:bad_path) do 86 | { 87 | 'tls.cacert' => 'ca.pem', 88 | 'tls.mycert' => 'cert.pem', 89 | 'tls.myprivkey' => 'key.pem' 90 | } 91 | end 92 | 93 | it { is_expected.not_to allow_value(bad_path) } 94 | end 95 | 96 | context 'bad array' do 97 | let(:bad_array) do 98 | { 99 | 'tls.permittedpeer' => 'host1' 100 | } 101 | end 102 | 103 | it { is_expected.not_to allow_value(bad_array) } 104 | end 105 | end 106 | end 107 | -------------------------------------------------------------------------------- /spec/type_aliases/actions/outputs/omsnmp_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Actions::Outputs::Omsnmp' do 6 | let(:data) do 7 | { 8 | server: 'localhost', 9 | port: 121, 10 | transport: 'tcp', 11 | version: 0, 12 | community: 'public', 13 | trapoid: '1.3.6.1.4.1.19406.1.2.1', 14 | messageoid: '1.3.6.1.4.1.19406.1.2.1', 15 | enterpriseoid: '1.3.6.1.4.1.3.1.1', 16 | specifictype: 0, 17 | traptype: 0 18 | } 19 | end 20 | 21 | context 'with valid data' do 22 | context 'full data' do 23 | it { is_expected.to allow_value(data) } 24 | end 25 | 26 | context 'individual parameters' do 27 | it 'is valid' do 28 | data.each do |param, value| 29 | expected_param = { param.to_sym => value } 30 | expected_param[:server] = 'localhost' unless param.to_s == 'server' 31 | expected_param[:port] = 121 unless param.to_s == 'port' 32 | is_expected.to allow_value(expected_param) 33 | end 34 | end 35 | end 36 | end 37 | 38 | context 'with invalid data' do 39 | context 'bad strings' do 40 | let(:bad_strings) do 41 | { 42 | server: '192.16.3.12', 43 | port: 121, 44 | transport: false, 45 | community: '', 46 | trapoid: 1, 47 | messageoid: 2, 48 | enterpriseoid: 3 49 | } 50 | end 51 | 52 | it { is_expected.not_to allow_value(bad_strings) } 53 | end 54 | 55 | context 'bad integers' do 56 | let(:bad_int) do 57 | { 58 | server: '192.16.3.12', 59 | port: '80', 60 | version: 3, 61 | specifictype: '0', 62 | traptype: 10 63 | } 64 | end 65 | 66 | it { is_expected.not_to allow_value(bad_int) } 67 | end 68 | 69 | context 'bad ip address' do 70 | let(:bad_ip) do 71 | { 72 | server: '300.122.32.', 73 | port: 121 74 | } 75 | end 76 | 77 | it { is_expected.not_to allow_value(bad_ip) } 78 | end 79 | end 80 | end 81 | -------------------------------------------------------------------------------- /spec/type_aliases/actions/outputs/omudpspoof_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Actions::Outputs::Omudpspoof' do 6 | let(:data) do 7 | { 8 | target: 'localhost', 9 | port: 514, 10 | sourcetemplate: 't_source', 11 | 'sourceport.start' => 32_000, 12 | 'sourceport.end' => 33_000, 13 | mtu: 1500, 14 | template: 't_udp_spoof' 15 | } 16 | end 17 | 18 | context 'with valid data' do 19 | context 'full data' do 20 | it { is_expected.to allow_value(data) } 21 | end 22 | 23 | context 'individual parameters' do 24 | it 'is valid' do 25 | data.each do |param, value| 26 | expected_param = { param.to_sym => value } 27 | expected_param[:target] = 'localhost' unless param.to_s == 'target' 28 | is_expected.to allow_value(expected_param) 29 | end 30 | end 31 | end 32 | end 33 | 34 | context 'with invalid data' do 35 | context 'bad strings' do 36 | let(:bad_strings) do 37 | { 38 | target: 'localhost', 39 | sourcetemplate: false, 40 | template: false 41 | } 42 | end 43 | 44 | it { is_expected.not_to allow_value(bad_strings) } 45 | end 46 | 47 | context 'bad integers' do 48 | let(:bad_int) do 49 | { 50 | target: 'localhost', 51 | port: '514', 52 | 'sourceport.start' => 70_000, 53 | 'sourceport.end' => 71_000, 54 | mtu: '1500' 55 | } 56 | end 57 | 58 | it { is_expected.not_to allow_value(bad_int) } 59 | end 60 | 61 | context 'bad ip address' do 62 | let(:bad_ip) do 63 | { 64 | target: '300.122.32.' 65 | } 66 | end 67 | 68 | it { is_expected.not_to allow_value(bad_ip) } 69 | end 70 | end 71 | end 72 | -------------------------------------------------------------------------------- /spec/type_aliases/actions/outputs/omusrmsg_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Actions::Outputs::Omusrmsg' do 6 | let(:data) do 7 | { 8 | users: '*', 9 | template: 't_usr_msg' 10 | } 11 | end 12 | 13 | context 'with valid data' do 14 | context 'full data' do 15 | it { is_expected.to allow_value(data) } 16 | end 17 | end 18 | 19 | context 'with invalid data' do 20 | context 'bad strings' do 21 | let(:bad_strings) do 22 | { 23 | users: 0, 24 | template: false 25 | } 26 | end 27 | 28 | it { is_expected.not_to allow_value(bad_strings) } 29 | end 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /spec/type_aliases/inputs/imbatchreports_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Inputs::Imbatchreports' do 6 | let(:data) do 7 | { 8 | reports: 'report', 9 | tag: 'tag', 10 | facility: 'kern', 11 | severity: 'info', 12 | deduplicatespaces: 'off', 13 | delete: '.ok$ .rejected', 14 | rename: '.ok$ .sent .rejected', 15 | programkey: 'APPNAME', 16 | timestampkey: 'TIMESTAMP' 17 | } 18 | end 19 | 20 | context 'with valid data' do 21 | context 'full data' do 22 | it { is_expected.to allow_value(data) } 23 | end 24 | 25 | context 'individual parameters' do 26 | it 'is valid' do 27 | required_params = { reports: data[:reports], tag: data[:tag] } 28 | data.each do |param, value| 29 | expected_param = { param.to_sym => value } 30 | is_expected.to allow_value(expected_param.merge!(required_params)) 31 | end 32 | end 33 | end 34 | end 35 | 36 | context 'with invalid data' do 37 | context 'missing_defaults' do 38 | it 'fails missing a default' do 39 | %w[reports tag].each do |param| 40 | is_expected.not_to allow_value(param.to_sym => param) 41 | end 42 | end 43 | end 44 | 45 | context 'bad_strings' do 46 | let(:bad_strings) do 47 | { 48 | reports: 10, 49 | tag: '', 50 | delete: true, 51 | rename: false, 52 | programkey: '', 53 | timestampkey: 20_151_011 54 | } 55 | end 56 | 57 | it { is_expected.not_to allow_value(bad_strings) } 58 | end 59 | end 60 | end 61 | -------------------------------------------------------------------------------- /spec/type_aliases/inputs/imfile_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Inputs::Imfile' do 6 | let(:data) do 7 | { 8 | file: '/var/log/file.log', 9 | tag: 'tag', 10 | facility: 'kern', 11 | severity: 'info', 12 | persiststateinterval: 60, 13 | 'startmsg.regex' => '^test$', 14 | 'endmsg.regex' => '^end$', 15 | readtimeout: 10, 16 | readmode: 2, 17 | escapelf: 'off', 18 | maxlinesatonce: 100, 19 | maxsubmitatonce: 10, 20 | deletestateonfiledelete: 'on', 21 | ruleset: 'test_ruleset', 22 | addmetadata: 'off', 23 | addceetag: 'off', 24 | reopenontruncate: 'on', 25 | trimlineoverbytes: 1024, 26 | freshstarttail: 'off', 27 | discardtruncatedmsg: 'on', 28 | msgdiscardingerror: 'off', 29 | neeparse: 'on' 30 | } 31 | end 32 | 33 | context 'with valid data' do 34 | context 'full data' do 35 | it { is_expected.to allow_value(data) } 36 | end 37 | 38 | context 'individual parameters' do 39 | it 'is valid' do 40 | required_params = { file: data[:file], tag: data[:tag] } 41 | data.each do |param, value| 42 | expected_param = { param.to_sym => value } 43 | is_expected.to allow_value(expected_param.merge!(required_params)) 44 | end 45 | end 46 | end 47 | end 48 | 49 | context 'with invalid data' do 50 | context 'missing defaults' do 51 | it 'file missing failure' do 52 | is_expected.not_to allow_value(tag: 'tag') 53 | end 54 | 55 | it 'tag missing failure' do 56 | is_expected.not_to allow_value(file: 'file') 57 | end 58 | end 59 | 60 | context 'bad strings' do 61 | let(:bad_strings) do 62 | { 63 | file: '', 64 | tag: '', 65 | 'startmsg.regex' => '', 66 | 'endmsg.regex' => '', 67 | ruleset: '' 68 | } 69 | end 70 | 71 | it { is_expected.not_to allow_value(:bad_strings) } 72 | end 73 | 74 | context 'bad_integers' do 75 | let(:bad_int) do 76 | { 77 | file: 'file', 78 | tag: 'tag', 79 | persiststateinterval: '100', 80 | readtimeout: '10m', 81 | maxlinesatonce: '100', 82 | maxsubmitatonce: nil, 83 | trimlineoverbytes: '1GB' 84 | } 85 | end 86 | 87 | it { is_expected.not_to allow_value(:bad_int) } 88 | end 89 | end 90 | end 91 | -------------------------------------------------------------------------------- /spec/type_aliases/inputs/imgssapi_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Inputs::Imgssapi' do 6 | let(:data) do 7 | { 8 | inputgssserverrun: 1514, 9 | inputgssserverservicename: 'foo', 10 | inputgssserverpermitplaintcp: 'on', 11 | inputgssservermaxsessions: 200, 12 | inputgssserverkeepalive: 'off', 13 | inputgsslistenportfilename: 514 14 | } 15 | end 16 | 17 | context 'with valid data' do 18 | context 'full data' do 19 | it { is_expected.to allow_value(data) } 20 | end 21 | 22 | context 'individual parameters' do 23 | it 'is valid' do 24 | data.each do |param, value| 25 | is_expected.to allow_value(param.to_sym => value) 26 | end 27 | end 28 | end 29 | end 30 | 31 | context 'with invalid data' do 32 | let(:bad_data) do 33 | { 34 | inputgssserverrun: 123_456, 35 | inputgssserverservicename: '', 36 | inputgssserverpermitplaintcp: true, 37 | inputgssservermaxsessions: '200', 38 | inputgssserverkeepalive: false, 39 | inputgsslistenportfilename: 234_567 40 | } 41 | end 42 | 43 | it 'fails' do 44 | bad_data.each do |param, value| 45 | is_expected.not_to allow_value(param.to_sym => value) 46 | end 47 | end 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /spec/type_aliases/inputs/imkafka_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Inputs::Imkafka' do 6 | let(:data) do 7 | { 8 | broker: 'localhost:9092', 9 | topic: 'foo', 10 | confparam: %w[bar baz test], 11 | consumergroup: 'group', 12 | ruleset: 'kafka_ruleset', 13 | parsehostname: 'on' 14 | } 15 | end 16 | 17 | context 'with valid data' do 18 | context 'full data' do 19 | it { is_expected.to allow_value(data) } 20 | end 21 | 22 | context 'individual parameters' do 23 | it 'is valid' do 24 | required_params = { topic: data[:topic] } 25 | data.each do |param, value| 26 | is_expected.to allow_value({ param.to_sym => value }.merge!(required_params)) 27 | end 28 | end 29 | end 30 | end 31 | 32 | context 'with invalid data' do 33 | context 'missing defaults' do 34 | it { is_expected.not_to allow_value(topic: '') } 35 | end 36 | 37 | context 'bad strings' do 38 | let(:bad_strings) do 39 | { 40 | broker: '', 41 | topic: '', 42 | consumergroup: '', 43 | ruleset: '', 44 | parsehostname: false 45 | } 46 | end 47 | 48 | it { is_expected.not_to allow_value(bad_strings) } 49 | end 50 | 51 | context 'bad array' do 52 | let(:bad_array) do 53 | { 54 | topic: 'foo', 55 | confparam: 'bar' 56 | } 57 | end 58 | 59 | it { is_expected.not_to allow_value(bad_array) } 60 | end 61 | end 62 | end 63 | -------------------------------------------------------------------------------- /spec/type_aliases/inputs/improg_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Inputs::Improg' do 6 | let(:data) do 7 | { 8 | binary: '/usr/local/bin/grep /foo/bar', 9 | tag: 'tag', 10 | facility: 'kern', 11 | severity: 'info', 12 | confirmmessages: 'off', 13 | signalonclose: 'on', 14 | closetimeout: 100, 15 | killunresponsive: 'off' 16 | } 17 | end 18 | 19 | context 'valid data' do 20 | context 'full data' do 21 | it { is_expected.to allow_value(data) } 22 | end 23 | 24 | context 'individual parameters' do 25 | it 'is valid' do 26 | required_params = { binary: data[:binary], tag: data[:tag] } 27 | data.each do |param, value| 28 | is_expected.to allow_value({ param.to_sym => value }.merge!(required_params)) 29 | end 30 | end 31 | end 32 | end 33 | 34 | context 'invalid data' do 35 | context 'missing required params' do 36 | it 'fails without binary' do 37 | is_expected.not_to allow_value(tag: 'tag') 38 | end 39 | 40 | it 'fails without tag' do 41 | is_expected.not_to allow_value(binary: 'binary') 42 | end 43 | end 44 | 45 | context 'invalid data type' do 46 | context 'invalid strings' do 47 | let(:bad_strings) do 48 | { 49 | binary: true, 50 | tag: '', 51 | confirmmessages: false, 52 | signalonclose: true, 53 | killunresponsive: false 54 | } 55 | end 56 | 57 | it { is_expected.not_to allow_value(bad_strings) } 58 | end 59 | 60 | context 'invalid integer' do 61 | let(:bad_number) do 62 | { 63 | binary: '/bin/cat file', 64 | tag: 'tag', 65 | closetimeout: '100' 66 | } 67 | end 68 | 69 | it { is_expected.not_to allow_value(bad_number) } 70 | end 71 | end 72 | end 73 | end 74 | -------------------------------------------------------------------------------- /spec/type_aliases/inputs/imptcp_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Inputs::Imptcp' do 6 | let(:data) do 7 | { 8 | port: 514, 9 | discardtruncatedmsg: 'off', 10 | fileowner: 'foo', 11 | filegroup: 'bar', 12 | fileownernum: 10, 13 | filegroupnum: 10, 14 | filecreatemode: '0644', 15 | failonchownfailure: 'off', 16 | unlink: 'off', 17 | name: 'test', 18 | ruleset: 't_ruleset', 19 | maxframesize: 1024, 20 | address: '127.0.0.1', 21 | addtlframedelimiter: 1, 22 | supportoctetcountetframing: 'on', 23 | notifyonconnectionclose: 'off', 24 | notifyonconnectionopen: 'on', 25 | keepalive: 'on', 26 | 'keepalive.probes' => 10, 27 | 'keepalive.interval' => 600, 28 | 'keepalive.time' => 120, 29 | 'ratelimit.interval' => 300, 30 | 'ratelimit.burst' => 30, 31 | 'compression.mode' => 'none', 32 | flowcontrol: 'off', 33 | multiline: 'on', 34 | 'framing.delimiter.regex' => '^test$', 35 | socketbacklog: 0, 36 | defaulttz: 'chicago', 37 | 'framingfix.cisco.asa' => 'on', 38 | listenportfilename: 'test' 39 | } 40 | end 41 | 42 | context 'valid data' do 43 | context 'default samples' do 44 | it 'passes' do 45 | is_expected.to allow_value(data) 46 | end 47 | 48 | it 'passes with path and not port/address' do 49 | %w[port address].each { |k| data.delete(k.to_sym) } 50 | data[:path] = '/foo/bar/log' 51 | is_expected.to allow_value(data) 52 | end 53 | end 54 | 55 | context 'individual param test' do 56 | it 'loops and tests each param' do 57 | data[:port] = 514 58 | data[:address] = '127.0.0.1' 59 | data.each do |param, value| 60 | is_expected.to allow_value(param => value) 61 | end 62 | end 63 | end 64 | end 65 | end 66 | -------------------------------------------------------------------------------- /spec/type_aliases/inputs/imrelp_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Inputs::Imrelp' do 6 | let(:data) do 7 | { 8 | port: 514, 9 | address: '127.0.0.1', 10 | name: 'test', 11 | ruleset: 't_ruleset', 12 | maxdatasize: '10k', 13 | tls: 'on', 14 | 'tls.compression' => 'on', 15 | 'tls.dhbits' => 1024, 16 | 'tls.permittedpeer' => %w[test test2 test3], 17 | 'tls.authmode' => 'fingerprint', 18 | 'tls.cacert' => 'SAsdvassdertew', 19 | 'tls.mycert' => 'asdvsaweasdfaa', 20 | 'tls.myprivkey' => 'sadfvrhthfg', 21 | 'tls.prioritystring' => 'expert_setting', 22 | keepalive: 'on', 23 | 'keepalive.probes' => 10, 24 | 'keepalive.interval' => 300, 25 | 'keepalive.time' => 30, 26 | oversizemode: 'truncate' 27 | } 28 | end 29 | 30 | context 'valid values' do 31 | it 'passes with pass data hash' do 32 | is_expected.to allow_value(data) 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /spec/type_aliases/inputs/imtcp_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Inputs::Imtcp' do 6 | let(:data) do 7 | { 8 | port: 514, 9 | address: '127.0.0.1', 10 | name: 'test', 11 | ruleset: 't_ruleset', 12 | supportoctetcountedframing: 'off', 13 | 'ratelimit.interval' => 0, 14 | 'ratelimit.burst' => 60_000, 15 | listenportfilename: 'foo' 16 | } 17 | end 18 | 19 | context 'passes with valid data' do 20 | it 'passes when passed some basic data' do 21 | is_expected.to allow_value(data) 22 | end 23 | 24 | it 'passes with each paramater' do 25 | req_param = { port: 514 } 26 | data.each do |param, value| 27 | is_expected.to allow_value({ param.to_sym => value }.merge!(req_param)) 28 | end 29 | end 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /spec/type_aliases/inputs/imtuxedoulog_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Inputs::Imtuxedoulog' do 6 | let(:data) do 7 | { 8 | ulogbase: '/foo/bar/path', 9 | tag: 'test', 10 | facility: 'kern', 11 | severity: 'info', 12 | persiststateinterval: 0, 13 | maxlinesatonce: 100, 14 | maxsubmitatonce: 1024 15 | } 16 | end 17 | 18 | context 'passes with valid values' do 19 | it 'passes with default samples' do 20 | is_expected.to allow_value(data) 21 | end 22 | 23 | it 'each individual optional param' do 24 | req_params = { 25 | ulogbase: '/foo/bar/path', 26 | tag: 'test' 27 | } 28 | data.each do |param, value| 29 | is_expected.to allow_value({ param.to_sym => value }.merge!(req_params)) 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /spec/type_aliases/inputs/imudp_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Inputs::Imudp' do 6 | let(:data) do 7 | { 8 | address: '127.0.0.1', 9 | port: 514, 10 | ipfreebind: 0, 11 | device: 'eth0', 12 | ruleset: 'r_udp', 13 | 'ratelimit.interval' => 0, 14 | 'ratelimit.burst' => 60_000, 15 | name: 'foo', 16 | 'name.appendport' => 'on', 17 | defaulttz: '-05:00', 18 | rcvbufsize: 0 19 | } 20 | end 21 | 22 | context 'when passed base data' do 23 | it 'receives data and passes' do 24 | is_expected.to allow_value(data) 25 | end 26 | 27 | it 'receives individual params and passes' do 28 | req_params = { port: 514 } 29 | data.each do |param, value| 30 | is_expected.to allow_value({ param.to_sym => value }.merge!(req_params)) 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /spec/type_aliases/inputs/imuxsock_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Inputs::Imuxsock' do 6 | let(:data) do 7 | { 8 | ruleset: 'r_socket', 9 | ignoretimestamp: 'off', 10 | ignoreownmessages: 'on', 11 | flowcontrol: 'on', 12 | 'ratelimit.interval' => 600, 13 | 'ratelimit.burst' => 60_000, 14 | 'ratelimit.severity' => 1, 15 | usepidfromsystem: 'on', 16 | usesystimestamp: 'on', 17 | createpath: 'on', 18 | socket: 'foo', 19 | hostname: 'localhost', 20 | annotate: 'off', 21 | parsetrusted: 'on', 22 | unlink: 'off', 23 | usespecialparser: 'off', 24 | parsehostname: 'on' 25 | } 26 | end 27 | 28 | context 'when passed default sample data' do 29 | it 'allows the values' do 30 | is_expected.to allow_value(data) 31 | end 32 | 33 | it 'allows the values when passed individually' do 34 | data.each do |param, value| 35 | is_expected.to allow_value(param.to_sym => value) 36 | end 37 | end 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /spec/type_aliases/modules/inputs/imdocker_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Modules::Inputs::Imdocker' do 6 | let(:data) do 7 | { 8 | dockerapiunixsockaddr: '/var/run/docker.sock', 9 | apiversionstr: 'v1.39', 10 | pollinginterval: 60, 11 | listcontaineroptions: 'all=1', 12 | getcontainerlogoptions: 'timestamp=0&follow=1&stdout=1&stderr=1&tail=1', 13 | retrievenewlogsfromstart: 1, 14 | defaultfacility: 'kern', 15 | defaultseverity: 'debug', 16 | escapelf: 'off' 17 | } 18 | end 19 | 20 | context 'when passed base data' do 21 | it 'receives data and passes' do 22 | is_expected.to allow_value(data) 23 | end 24 | 25 | it 'receives individual params and passes' do 26 | data.each do |param, value| 27 | is_expected.to allow_value(param.to_sym => value) 28 | end 29 | end 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /spec/type_aliases/modules/inputs/imfile_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Modules::Inputs::Imfile' do 6 | let(:data) do 7 | { 8 | mode: 'inotify', 9 | readtimeout: 300, 10 | timeoutgranularity: 'on', 11 | sortfiles: 'off', 12 | pollinginterval: 60 13 | } 14 | end 15 | 16 | context 'when passed base data' do 17 | it 'receives data and passes' do 18 | is_expected.to allow_value(data) 19 | end 20 | 21 | it 'receives individual params and passes' do 22 | data.each do |param, value| 23 | is_expected.to allow_value(param.to_sym => value) 24 | end 25 | end 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /spec/type_aliases/modules/inputs/imjournal_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'Rsyslog::Modules::Inputs::Imjournal' do 6 | let(:data) do 7 | { 8 | persiststateinterval: 10, 9 | statefile: '/var/log/statefile', 10 | 'ratelimit.interval' => 600, 11 | 'ratelimit.burst' => 20_000, 12 | ignorepreviousmessage: 'off', 13 | defaultseverity: 'notice', 14 | defaultfacility: 'kern', 15 | usepidfromsystem: 'off', 16 | usepid: 'both', 17 | ignorenonvalidstatefile: 'on', 18 | workaroundjournalbug: 'on' 19 | } 20 | end 21 | 22 | context 'when passed base data' do 23 | it 'receives data and passes' do 24 | is_expected.to allow_value(data) 25 | end 26 | 27 | it 'receives individual params and passes' do 28 | data.each do |param, value| 29 | is_expected.to allow_value(param.to_sym => value) 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /templates/action.epp: -------------------------------------------------------------------------------- 1 | <%- | 2 | $action_name, 3 | $type, 4 | $facility, 5 | $config 6 | | -%> 7 | # <%= $action_name %> 8 | <% if $facility != "default" and size($config) < 3 { -%> 9 | <%= sprintf( '%-30s %s%s%s', $facility, 'action(type="',$type,'" ' )-%> 10 | <% if $config { -%> 11 | <% $config.each |$k, $v| { -%> <%= $k -%>="<%= $v -%>" <% }-%>) 12 | <%-}%> 13 | <%}-%> 14 | <% elsif $facility != "default" and size($config) > 2 { -%> 15 | <%= sprintf( '%-30s %s%s%s', $facility, 'action(type="',$type,'" ' )%> 16 | <% if $config { -%> 17 | <% $config.each |$k, $v| { -%> 18 | <%= sprintf('%33s%-s="%s"',' ',$k,$v)%> 19 | <%}-%> 20 | <%}-%> 21 | <%= sprintf('%32s',')') %> 22 | <% } else { -%> 23 | action(type="<%= $type %>" 24 | <% if $action_name { -%> 25 | name="<%= $action_name %>" 26 | <%}-%> 27 | <% if $config { -%> 28 | <% $config.each |$k, $v| { -%> 29 | <%- if $v =~ Array { -%> 30 | <%= $k %>=<%= join(["[\"", join($v, '", "'), "\"]"], "") %> 31 | <%- } else { -%> 32 | <%= $k %>="<%= $v %>" 33 | <%-}-%> 34 | <%}-%> 35 | <%}-%> 36 | ) 37 | <%}-%> 38 | -------------------------------------------------------------------------------- /templates/call.epp: -------------------------------------------------------------------------------- 1 | <%- | 2 | String $value 3 | | -%> 4 | call <%= $value -%> -------------------------------------------------------------------------------- /templates/exec.epp: -------------------------------------------------------------------------------- 1 | <%- | 2 | String $value 3 | | -%> 4 | ^<%= $value -%> 5 | -------------------------------------------------------------------------------- /templates/expression_filter.epp: -------------------------------------------------------------------------------- 1 | <%- | 2 | $filter_name, 3 | $cases 4 | | -%> 5 | # <%= $filter_name %> 6 | <%- $cases.each |$case, $options| { -%> 7 | <%- if $case =~ /(default|else)/{ -%> 8 | <%= $case %> { 9 | <%- } elsif $case =~ /(main|if)/ { -%> 10 | <%= "if ${options['expression']} then" %> { 11 | <%- } else { -%> 12 | <%= "else if ${options['expression']} then" %> { 13 | <%-}-%> 14 | <%- $options['tasks'].each |$task| { -%> 15 | <%= epp('rsyslog/tasks.epp', { 'tasks' => $task }) -%> 16 | <%-}-%> 17 | } 18 | <%}-%> 19 | -------------------------------------------------------------------------------- /templates/generic.epp: -------------------------------------------------------------------------------- 1 | <%- | 2 | $object_name, 3 | $config 4 | | -%> 5 | <%= $object_name %>( 6 | <% $config.each |$k, $v| { -%> 7 | <%= $k %>="<%= $v %>" 8 | <%}-%> 9 | ) 10 | -------------------------------------------------------------------------------- /templates/global_config.epp: -------------------------------------------------------------------------------- 1 | <%- | 2 | String $type, 3 | String $value="dummy", 4 | String $config_item="dummy", 5 | Hash $config={}, 6 | | -%> 7 | <% if $type == 'legacy' { -%> 8 | $<%= $config_item %> <%= $value %> 9 | <% } else { -%> 10 | global ( 11 | <% $config.each |$item, $data| { -%> 12 | <%= $item %>="<%=$data%>" 13 | <%}-%> 14 | 15 | ) 16 | <% } -%> 17 | -------------------------------------------------------------------------------- /templates/input.epp: -------------------------------------------------------------------------------- 1 | <%- | 2 | $input_name, 3 | $type, 4 | $config 5 | | -%> 6 | # <%= $input_name %> 7 | input(type="<%= $type %>" 8 | <% $config.each |$k, $v| { -%> 9 | <%- if $v =~ Array { -%> 10 | <%= $k %>=[ <%= $v.map |$i| { "\"${i}\"" }.join(', ') %> ] 11 | <%- } else { -%> 12 | <%= $k %>="<%= $v %>" 13 | <%- } -%> 14 | <%}-%> 15 | ) 16 | -------------------------------------------------------------------------------- /templates/legacy_config.epp: -------------------------------------------------------------------------------- 1 | <%- | 2 | String $config_item, 3 | String $value, 4 | Optional[String] $key, 5 | Optional[String] $type 6 | | -%> 7 | <% if $type == 'sysklogd' { -%> 8 | # <%= $config_item %> 9 | <%= $key %> <%= $value %> 10 | 11 | <% } else { -%> 12 | # <%= $config_item %> 13 | <%= $value %> 14 | 15 | <% } -%> 16 | -------------------------------------------------------------------------------- /templates/lookup.epp: -------------------------------------------------------------------------------- 1 | <%- | 2 | String $variable_name, 3 | String $lookup_table, 4 | String $lookup_expr 5 | | -%> 6 | set $.<%= $variable_name %> = lookup("<%= $lookup_table %>", <%= $lookup_expr %>); -------------------------------------------------------------------------------- /templates/lookup_table.epp: -------------------------------------------------------------------------------- 1 | <%- | 2 | $lookup_table_name, 3 | $file, 4 | $reload_on_hup 5 | | -%> 6 | # <%= $lookup_table_name %> 7 | <% if $reload_on_hup == true { -%> 8 | <% $hup = 'on' -%> 9 | <% } else { -%> 10 | <% $hup = 'off' -%> 11 | <%}-%> 12 | lookup_table(name="<%= $lookup_table_name %>" file="<%= $file %>" reloadOnHUP="<%= $hup %>") 13 | -------------------------------------------------------------------------------- /templates/modules.epp: -------------------------------------------------------------------------------- 1 | <%- | 2 | String $config_item, 3 | String $type, 4 | Optional[Hash] $config 5 | | -%> 6 | <% if $type == 'external' and empty($config) == true { -%> 7 | module(load="<%=$config_item -%>") 8 | <% } -%> 9 | <% elsif $type == 'external' and empty($config) == false { -%> 10 | module(load="<%= $config_item -%>" 11 | <% $config.each |$key, $value| {-%> 12 | <%- if $value =~ Array { -%> 13 | <%= $key %>=<%= to_json($value) -%> 14 | <%- } else { -%> 15 | <%= $key %>="<%= $value -%>" 16 | <%- } -%> 17 | <% } %> 18 | ) 19 | <% } -%> 20 | <% elsif $type == 'builtin' and empty($config) == true { -%> 21 | module(load="builtin:<%= $config_item -%>" ) 22 | <% } -%> 23 | <% elsif $type == 'builtin' and empty($config) == false { -%> 24 | module(load="builtin:<%= $config_item -%>" 25 | <% $config.each |$key, $value| {-%> 26 | <%= $key %>="<%= $value -%>" 27 | <% } %> 28 | ) 29 | <%}-%> 30 | -------------------------------------------------------------------------------- /templates/parser.epp: -------------------------------------------------------------------------------- 1 | <%- | 2 | $parser_name, 3 | $type, 4 | $config 5 | | -%> 6 | # <%= $parser_name %> 7 | parser(name="<%= $parser_name %>" 8 | type="<%= $type %>" 9 | <% $config.each |$k, $v| { -%> 10 | <%= $k %>="<%= $v %>" 11 | <%}-%> 12 | ) -------------------------------------------------------------------------------- /templates/property_filter.epp: -------------------------------------------------------------------------------- 1 | <%- | 2 | $filter_name, 3 | String $property, 4 | Rsyslog::PropertyOperator $operator, 5 | String $value, 6 | Array $tasks 7 | | -%> 8 | # <%= $filter_name %> 9 | :<%= $property %>, <%= $operator %>, "<%= $value %>" { 10 | <%- $tasks.each |$task| { -%> 11 | <%= epp('rsyslog/tasks.epp', { 'tasks' => $task }) -%> 12 | <%-}-%> 13 | } 14 | -------------------------------------------------------------------------------- /templates/ruleset.epp: -------------------------------------------------------------------------------- 1 | <%- | 2 | $ruleset_name, 3 | $parameters, 4 | $rules, 5 | $stop 6 | | -%> 7 | # <%= $ruleset_name %> ruleset 8 | ruleset (name="<%= $ruleset_name %>" 9 | <% $parameters.each |$key, $value| { -%> 10 | <%= $key %>="<%= $value %>"<%-%> 11 | <%}-%> 12 | ) { 13 | <%- $rules.each |$rule| { -%> 14 | <%- $rule.each |$key, $params| { -%> 15 | <%- if $key == 'property_filter' { -%> 16 | <%= epp('rsyslog/property_filter.epp', { 'filter_name' => 'Property-based Filter', 'property' => $params['property'], 'operator' => $params['operator'], 'value' => $params['value'], 'tasks' => $params['tasks']}) %> 17 | <%- } elsif $key == 'expression_filter' { -%> 18 | <%= epp('rsyslog/expression_filter.epp', { 'filter_name' => 'Expression-based Filter', 'cases' => $params['filter'] }) -%> 19 | <%- } else { %> 20 | <%= epp('rsyslog/tasks.epp', { 'tasks' => $rule }) -%> 21 | <%-}-%> 22 | <%-}-%> 23 | <%-}-%> 24 | <%- if $stop { -%> 25 | stop 26 | <%-}-%> 27 | } 28 | -------------------------------------------------------------------------------- /templates/set.epp: -------------------------------------------------------------------------------- 1 | <%- | 2 | String $name, 3 | String $value 4 | | -%> 5 | <% if $name =~ /^(\$\.|\$!)\w*$/ {-%> 6 | set <%= $name %> = <%= $value %>; 7 | <%} else {-%> 8 | <%# This is deprecated and only here to maintain compatibility %> 9 | set $.<%= $name %> = <%= $value %>; 10 | <%}-%> -------------------------------------------------------------------------------- /templates/tasks.epp: -------------------------------------------------------------------------------- 1 | <%- | 2 | $tasks 3 | | -%> 4 | <%- $tasks.each |$config, $cfgval| { -%> 5 | <%- if $config == 'call' { -%> 6 | <%= epp('rsyslog/call.epp', { 'value' => $cfgval, }) %><%-%> 7 | <%- } elsif $config == 'lookup'{ -%> 8 | <%= epp('rsyslog/lookup.epp', { 'variable_name' => $cfgval['var'], 'lookup_table' => $cfgval['lookup_table'], 'lookup_expr' => $cfgval['expr'], }) %><%-%> 9 | <%- } elsif $config == 'set' { -%> 10 | <%- $cfgval.each |$name, $value| { -%> 11 | <%= epp('rsyslog/set.epp', { 'name' => $name, 'value' => $value }) %><%-%> 12 | <%}-%> 13 | <%- } elsif $config == 'action' { -%> 14 | <%- if ! $cfgval['facility'] or $cfgval['facility'] == '' { $facility = 'default' } else { $facility = $cfgval['facility'] } -%> 15 | <%= epp('rsyslog/action.epp', { 'action_name' => $cfgval['name'], 'type' => $cfgval['type'], 'facility' => $facility, 'config' => $cfgval['config'],}) %> 16 | <%-} elsif $config == 'stop' { -%> 17 | stop 18 | <%} elsif $config == 'exec' { -%> 19 | <%= epp('rsyslog/exec.epp', { 'value' => $cfgval, }) %><%-%> 20 | <%-}-%> 21 | <%-}-%> -------------------------------------------------------------------------------- /templates/template.epp: -------------------------------------------------------------------------------- 1 | <%- | 2 | $template_name, 3 | $string, 4 | $list_descriptions, 5 | $type, 6 | $subtree, 7 | $plugin , 8 | $options 9 | | %> 10 | template (name="<%= $template_name %>" type="<%= $type %>"<%-%> 11 | <% if $type == 'string' { -%> 12 | string="<%= $string %>"<%-%> 13 | <%}-%> 14 | <% if $type == 'subtree' { -%> 15 | subtree="<%= $subtree %>"<%-%> 16 | <%}-%> 17 | <% if $type == 'plugin' { -%> 18 | plugin="<%= $plugin %>"<%-%> 19 | <%}-%> 20 | <% $options.each |$option,$value| {-%> <%= " option.${option}" %>="<%= $value %>"<%}-%> 21 | ) 22 | <% if $type == 'list' { -%> 23 | { 24 | <% $list_descriptions.each | $element | { -%> 25 | <%- $element.each |$key, $params| { -%> 26 | <%= $key %>(<% $params.each |$p,$v| { -%> <%= $p%>="<%= $v %>" <% }%>)<% } %> 27 | <%}-%> 28 | } 29 | <%}-%> 30 | -------------------------------------------------------------------------------- /types/actions.pp: -------------------------------------------------------------------------------- 1 | # Struct data type alias for Rsyslog Actions 2 | type Rsyslog::Actions = Array[ 3 | Struct[{ 4 | name => String[1], 5 | type => Rsyslog::Modules::Output, 6 | facility => Optional[String[1]], 7 | action_params => Optional[Rsyslog::Actions::Parameters], 8 | queue_params => Optional[Rsyslog::Queue::Parameters], 9 | output_params => Optional[Variant[ 10 | Rsyslog::Actions::Outputs::Omamqp1, 11 | Rsyslog::Actions::Outputs::Omelasticsearch, 12 | Rsyslog::Actions::Outputs::Omfile, 13 | Rsyslog::Actions::Outputs::Omfwd, 14 | Rsyslog::Actions::Outputs::Omhiredis, 15 | Rsyslog::Actions::Outputs::Omhttpfs, 16 | Rsyslog::Actions::Outputs::Omjournal, 17 | Rsyslog::Actions::Outputs::Omkafka, 18 | Rsyslog::Actions::Outputs::Omlibdbi, 19 | Rsyslog::Actions::Outputs::Ommail, 20 | Rsyslog::Actions::Outputs::Ommongodb, 21 | Rsyslog::Actions::Outputs::Ommysql, 22 | Rsyslog::Actions::Outputs::Ompgsql, 23 | Rsyslog::Actions::Outputs::Ompipe, 24 | Rsyslog::Actions::Outputs::Omprog, 25 | Rsyslog::Actions::Outputs::Omrelp, 26 | Rsyslog::Actions::Outputs::Omsnmp, 27 | Rsyslog::Actions::Outputs::Omudpspoof, 28 | Rsyslog::Actions::Outputs::Omusrmsg, 29 | ]], 30 | }] 31 | ] 32 | -------------------------------------------------------------------------------- /types/actions/outputs/omamqp1.pp: -------------------------------------------------------------------------------- 1 | type Rsyslog::Actions::Outputs::Omamqp1 = Struct[{ 2 | host => String[1], 3 | target => String[1], 4 | username => Optional[String[1]], 5 | password => Optional[String[1]], 6 | template => Optional[String[1]], 7 | idletimeout => Optional[Integer], 8 | reconnectdelay => Optional[Integer], 9 | maxretries => Optional[Integer], 10 | disablesasl => Optional[Integer], 11 | }] 12 | -------------------------------------------------------------------------------- /types/actions/outputs/omelasticsearch.pp: -------------------------------------------------------------------------------- 1 | type Rsyslog::Actions::Outputs::Omelasticsearch = Struct[{ 2 | server => Optional[Variant[Stdlib::Host, Array[Stdlib::Host]]], 3 | serverport => Optional[Stdlib::Port], 4 | healthchecktimeout => Optional[Integer], 5 | searchindex => Optional[String[1]], 6 | dynsearchindex => Optional[Enum['on', 'off']], 7 | searchtype => Optional[String[1]], 8 | dynsearchtype => Optional[Enum['on', 'off']], 9 | pipelinename => Optional[String[1]], 10 | dynpipelinename => Optional[Enum['on', 'off']], 11 | usehttps => Optional[Enum['on', 'off']], 12 | timeout => Optional[Pattern[/^([0-9]+)(ms|s|m)$/]], 13 | template => Optional[String[1]], 14 | bulkmode => Optional[Enum['on', 'off']], 15 | maxbytes => Optional[Pattern[/^([0-9]+)[kKmMgGtT]$/]], 16 | parent => Optional[String[1]], 17 | dynparent => Optional[Enum['on', 'off']], 18 | uid => Optional[String[1]], 19 | pwd => Optional[String[1]], 20 | errorfile => Optional[Stdlib::Absolutepath], 21 | 'tls.cacert' => Optional[Stdlib::Absolutepath], 22 | 'tls.mycert' => Optional[Stdlib::Absolutepath], 23 | 'tls.myprivkey' => Optional[Stdlib::Absolutepath], 24 | bulkid => Optional[String[1]], 25 | dynbulkid => Optional[Enum['on', 'off']], 26 | writeoperation => Optional[Enum['index', 'create']], 27 | retryfailures => Optional[Enum['on', 'off']], 28 | retryruleset => Optional[String[1]], 29 | 'ratelimit.interval' => Optional[Integer], 30 | 'ratelimit.burst' => Optional[Integer], 31 | }] 32 | -------------------------------------------------------------------------------- /types/actions/outputs/omfile.pp: -------------------------------------------------------------------------------- 1 | type Rsyslog::Actions::Outputs::Omfile = Struct[{ 2 | file => Optional[Stdlib::Absolutepath], 3 | dynafile => Optional[String[1]], 4 | template => Optional[String[1]], 5 | closetimeout => Optional[Integer], 6 | dynafilecachesize => Optional[Integer], 7 | ziplevel => Optional[Integer], 8 | veryrobustzip => Optional[Enum['on', 'off']], 9 | flushinterval => Optional[Integer], 10 | asyncwriting => Optional[Enum['on', 'off']], 11 | flushontxend => Optional[Enum['on', 'off']], 12 | iobuffersize => Optional[Pattern[/^([0-9]+)[kKmMgGtT]$/]], 13 | dirowner => Optional[String[1]], 14 | dirownernum => Optional[Integer], 15 | dirgroup => Optional[String[1]], 16 | dirgroupnum => Optional[Integer], 17 | fileowner => Optional[String[1]], 18 | fileownernum => Optional[Integer], 19 | filegroup => Optional[String[1]], 20 | filegroupnum => Optional[Integer], 21 | filecreatemode => Optional[Pattern[/^(([0-7]{1,4})*)$/]], 22 | dircreatemode => Optional[Pattern[/^(([0-7]{1,4})*)$/]], 23 | failonchownfailure => Optional[Enum['on', 'off']], 24 | createdirs => Optional[Enum['on', 'off']], 25 | sync => Optional[Enum['on', 'off']], 26 | 'sig.provider' => Optional[Enum['ksi_ls12']], 27 | 'cry.provider' => Optional[Enum['gcry']], 28 | }] 29 | -------------------------------------------------------------------------------- /types/actions/outputs/omfwd.pp: -------------------------------------------------------------------------------- 1 | type Rsyslog::Actions::Outputs::Omfwd = Struct[{ 2 | target => Optional[Stdlib::Host], 3 | port => Optional[Stdlib::Port], 4 | protocol => Optional[Enum['tcp', 'udp', 'ossl', 'gtls']], 5 | networknamespace => Optional[String[1]], 6 | address => Optional[Stdlib::IP::Address], 7 | ipfreebind => Optional[Integer[0, 2]], 8 | device => Optional[String[1]], 9 | tcp_framing => Optional[Enum['traditional', 'octet-counted']], 10 | tcp_framedelimiter => Optional[Integer[0, 255]], 11 | ziplevel => Optional[Integer[0, 9]], 12 | 'compression.mode' => Optional[Enum['none', 'single', 'stream:always']], 13 | 'compression.stream.flushontxend' => Optional[Enum['on', 'off']], 14 | rebindinterval => Optional[Integer], 15 | keepalive => Optional[Enum['on', 'off']], 16 | 'keepalive.probes' => Optional[Integer], 17 | 'keepalive.interval' => Optional[Integer], 18 | 'keepalive.time' => Optional[Integer], 19 | streamdriver => Optional[Enum['tcp', 'ossl', 'gtls']], 20 | streamdrivermode => Optional[Integer], 21 | streamdriverauthmode => Optional[String[1]], 22 | streamdriverpermittedpeers => Optional[String[1]], 23 | resendlastmsgonreconnect => Optional[Enum['on', 'off']], 24 | 'udp.sendtoall' => Optional[Enum['on', 'off']], 25 | 'udp.senddelay' => Optional[Integer], 26 | gnutlsprioritystring => Optional[String[1]], 27 | }] 28 | -------------------------------------------------------------------------------- /types/actions/outputs/omhiredis.pp: -------------------------------------------------------------------------------- 1 | type Rsyslog::Actions::Outputs::Omhiredis = Struct[{ 2 | server => Optional[Stdlib::Host], 3 | serverport => Optional[Stdlib::Port], 4 | serverpassword => Optional[String[1]], 5 | mode => Optional[Enum['queue', 'publish', 'template']], 6 | template => Optional[String[1]], 7 | key => Optional[String[1]], 8 | userpush => Optional[Enum['on', 'off']] 9 | }] 10 | -------------------------------------------------------------------------------- /types/actions/outputs/omhttpfs.pp: -------------------------------------------------------------------------------- 1 | type Rsyslog::Actions::Outputs::Omhttpfs = Struct[{ 2 | host => Optional[Stdlib::Host], 3 | port => Optional[Stdlib::Port], 4 | user => Optional[String[1]], 5 | https => Optional[Enum['on', 'off']], 6 | file => String[1], 7 | isdynfile => Optional[Enum['on', 'off']], 8 | template => Optional[String[1]] 9 | }] 10 | -------------------------------------------------------------------------------- /types/actions/outputs/omjournal.pp: -------------------------------------------------------------------------------- 1 | # Struct data type for the Rsyslog JournalD module's Action options 2 | type Rsyslog::Actions::Outputs::Omjournal = Struct[{ 3 | template => Optional[String[1]], 4 | }] 5 | -------------------------------------------------------------------------------- /types/actions/outputs/omkafka.pp: -------------------------------------------------------------------------------- 1 | # Struct data type for the Rsyslog Kafka module's Action options 2 | type Rsyslog::Actions::Outputs::Omkafka = Struct[{ 3 | broker => Optional[String[1]], 4 | topic => String[1], 5 | key => Optional[String[1]], 6 | dynatopic => Optional[Enum['on', 'off']], 7 | 'dynatopic.cachesize' => Optional[Integer], 8 | 'partitions.auto' => Optional[Enum['on', 'off']], 9 | 'partitions.number' => Optional[Integer], 10 | 'partitions.usefixed' => Optional[Integer], 11 | errorfile => Optional[String[1]], 12 | confparam => Optional[Array[String[1]]], 13 | topicconfparam => Optional[Array[String[1]]], 14 | template => Optional[String[1]], 15 | closetimeout => Optional[Integer], 16 | resubmitonfailure => Optional[Enum['on', 'off']], 17 | keepfailedmessages => Optional[Enum['on', 'off']], 18 | failedmsgfile => Optional[String[1]], 19 | }] 20 | -------------------------------------------------------------------------------- /types/actions/outputs/omlibdbi.pp: -------------------------------------------------------------------------------- 1 | # Struct data type for the Rsyslog libdbi module's Action options 2 | type Rsyslog::Actions::Outputs::Omlibdbi = Struct[{ 3 | driver => Enum[ 4 | 'firebird', 5 | 'ingres', 6 | 'msql', 7 | 'Oracle', 8 | 'sqlite', 9 | 'sqlite3', 10 | 'freetds', 11 | ], 12 | server => Stdlib::Host, 13 | uid => String[1], 14 | pwd => String[1], 15 | db => String[1], 16 | template => Optional[String[1]], 17 | }] 18 | -------------------------------------------------------------------------------- /types/actions/outputs/ommail.pp: -------------------------------------------------------------------------------- 1 | # Struct data type for the Rsyslog E-Mail module's Action options 2 | type Rsyslog::Actions::Outputs::Ommail = Struct[{ 3 | server => Stdlib::Host, 4 | port => Stdlib::Port, 5 | mailfrom => Pattern[/.+@.+\..+/], 6 | mailto => Pattern[/.+@.+\..+/], 7 | 'subject.template' => Optional[String[1]], 8 | 'subject.text' => Optional[String[1]], 9 | 'body.enable' => Optional[Enum['on', 'off']], 10 | template => Optional[String[1]], 11 | }] 12 | -------------------------------------------------------------------------------- /types/actions/outputs/ommongodb.pp: -------------------------------------------------------------------------------- 1 | # Struct data type for the Rsyslog MongoDB output module's Action options 2 | type Rsyslog::Actions::Outputs::Ommongodb = Struct[{ 3 | uristr => Optional[String[1]], 4 | ssl_cert => Optional[Stdlib::Absolutepath], 5 | ssl_ca => Optional[Stdlib::Absolutepath], 6 | db => Optional[String[1]], 7 | collection => Optional[String[1]], 8 | allowed_error_codes => Optional[Array[String[1]]], 9 | template => Optional[String[1]], 10 | server => Optional[Stdlib::Host], 11 | serverported => Optional[Stdlib::Port], 12 | uid => Optional[String[1]], 13 | pwd => Optional[String[1]], 14 | }] 15 | -------------------------------------------------------------------------------- /types/actions/outputs/ommysql.pp: -------------------------------------------------------------------------------- 1 | # Struct data type alias for MySQL Rsyslog output module. 2 | # 3 | # @see https://www.rsyslog.com/doc/v8-stable/configuration/modules/ommysql.html Rsyslog MySQL output module 4 | type Rsyslog::Actions::Outputs::Ommysql = Struct[{ 5 | server => Stdlib::Host, 6 | socket => Optional[Stdlib::Absolutepath], 7 | db => String[1], 8 | uid => String[1], 9 | pwd => String[1], 10 | serverport => Optional[Stdlib::Port], 11 | 'mysqlconfig.file' => Optional[Stdlib::Absolutepath], 12 | 'mysqlconfig.section' => Optional[String[1]], 13 | template => Optional[String[1]], 14 | }] 15 | -------------------------------------------------------------------------------- /types/actions/outputs/ompgsql.pp: -------------------------------------------------------------------------------- 1 | # Struct data type for the Rsyslog PostgreSQL module's Action options 2 | # 3 | # Not allowing the serverport, uid, or pwd rsyslog options as they are 4 | # identical to port, user, and pass respectively. The latter make more 5 | # sense to the general user and the former are redundant. 6 | type Rsyslog::Actions::Outputs::Ompgsql = Struct[{ 7 | server => Stdlib::Host, 8 | port => Optional[Stdlib::Port], 9 | db => String[1], 10 | user => Optional[String[1]], 11 | pass => Optional[String[1]], 12 | template => Optional[String[1]], 13 | }] 14 | -------------------------------------------------------------------------------- /types/actions/outputs/ompipe.pp: -------------------------------------------------------------------------------- 1 | # Struct data type for the Rsyslog Pipe module's Action options 2 | type Rsyslog::Actions::Outputs::Ompipe = Struct[{ 3 | pipe => String[1], 4 | }] 5 | -------------------------------------------------------------------------------- /types/actions/outputs/omprog.pp: -------------------------------------------------------------------------------- 1 | # Struct data type for the Rsyslog Program module's Action options 2 | type Rsyslog::Actions::Outputs::Omprog = Struct[{ 3 | template => Optional[String[1]], 4 | binary => Stdlib::Absolutepath, 5 | confirmmessages => Optional[Enum['on', 'off']], 6 | confirmtimeout => Optional[Integer], 7 | reportfailures => Optional[Enum['on', 'off']], 8 | usetransactions => Optional[Enum['on', 'off']], 9 | begintransactionmark => Optional[String[1]], 10 | committransactionmark => Optional[String[1]], 11 | output => Optional[Stdlib::Absolutepath], 12 | filecreatemode => Optional[Stdlib::Filemode], 13 | 'hup.signal' => Optional[Enum['HUP', 'USR1', 'USR2', 'INT', 'TERM']], 14 | signalonclose => Optional[Enum['on', 'off']], 15 | closetimeout => Optional[Integer], 16 | killunresponsive => Optional[Enum['on', 'off']], 17 | forcesingleinstance => Optional[Enum['on', 'off']], 18 | }] 19 | -------------------------------------------------------------------------------- /types/actions/outputs/omrelp.pp: -------------------------------------------------------------------------------- 1 | # Struct data type for the Rsyslog RELP module's Action options 2 | type Rsyslog::Actions::Outputs::Omrelp = Struct[{ 3 | target => Variant[Stdlib::Fqdn, Stdlib::IP::Address], 4 | port => Optional[Stdlib::Port], 5 | template => Optional[String[1]], 6 | timeout => Optional[Integer], 7 | 'conn.timeout' => Optional[Integer], 8 | rebindinterval => Optional[Integer], 9 | windowsize => Optional[Integer], 10 | tls => Optional[Enum['on', 'off']], 11 | 'tls.compression' => Optional[Enum['on', 'off']], 12 | 'tls.permittedpeer' => Optional[Array[String[1]]], 13 | 'tls.automode' => Optional[Enum['fingerprint', 'name']], 14 | 'tls.cacert' => Optional[Stdlib::Absolutepath], 15 | 'tls.mycert' => Optional[Stdlib::Absolutepath], 16 | 'tls.myprivkey' => Optional[Stdlib::Absolutepath], 17 | 'tls.prioritystring' => Optional[String[1]], 18 | localclientip => Optional[Stdlib::IP::Address], 19 | }] 20 | -------------------------------------------------------------------------------- /types/actions/outputs/omsnmp.pp: -------------------------------------------------------------------------------- 1 | # Struct data type for the Rsyslog SNMP module's Action options 2 | type Rsyslog::Actions::Outputs::Omsnmp = Struct[{ 3 | server => Stdlib::Host, 4 | port => Optional[Stdlib::Port], 5 | transport => Optional[String[1]], 6 | version => Optional[Integer[0,1]], 7 | community => Optional[String[1]], 8 | trapoid => Optional[String[1]], 9 | messageoid => Optional[String[1]], 10 | enterpriseoid => Optional[String[1]], 11 | specifictype => Optional[Integer], 12 | traptype => Optional[Integer[0,6]], 13 | }] 14 | -------------------------------------------------------------------------------- /types/actions/outputs/omudpspoof.pp: -------------------------------------------------------------------------------- 1 | # Struct data type for the Rsyslog UDP Spoof module's Action options 2 | type Rsyslog::Actions::Outputs::Omudpspoof = Struct[{ 3 | target => Stdlib::Host, 4 | port => Optional[Stdlib::Port], 5 | sourcetemplate => Optional[String[1]], 6 | 'sourceport.start' => Optional[Stdlib::Port], 7 | 'sourceport.end' => Optional[Stdlib::Port], 8 | mtu => Optional[Integer], 9 | template => Optional[String[1]], 10 | }] 11 | -------------------------------------------------------------------------------- /types/actions/outputs/omusrmsg.pp: -------------------------------------------------------------------------------- 1 | # Struct data type for the Rsyslog User MSG module's Action Parameters. 2 | type Rsyslog::Actions::Outputs::Omusrmsg = Struct[{ 3 | users => String[1], 4 | template => Optional[String[1]], 5 | }] 6 | -------------------------------------------------------------------------------- /types/actions/parameters.pp: -------------------------------------------------------------------------------- 1 | # Struct data type for general Rsyslog Action parameters 2 | # 3 | # @author Vox Pupuli 4 | # 5 | # @see https://www.rsyslog.com/doc/v8-stable/configuration/actions.html#general-action-parameters Rsyslog General Action Parameters 6 | # 7 | type Rsyslog::Actions::Parameters = Struct[{ 8 | 'action.writeallmarkmessages' => Optional[Enum['on', 'off']], 9 | 'action.execonlyeverynthtime' => Optional[Integer], 10 | 'action.execonlyeverynthtimeout' => Optional[Integer], 11 | 'action.errorfile' => Optional[Stdlib::Absolutepath], 12 | 'action.execonlyonceeveryinterval' => Optional[Integer], 13 | 'action.execonlywhenpreviousissuspended' => Optional[Enum['on', 'off']], 14 | 'action.repeatedmsgcontainsoriginalmsg' => Optional[Enum['on', 'off']], 15 | 'action.resumeretrycount' => Optional[Integer], 16 | 'action.resumeinterval' => Optional[Integer], 17 | 'action.reportsuspension' => Optional[Enum['on', 'off']], 18 | 'action.reportsuspensioncontinuation' => Optional[Enum['on', 'off']], 19 | 'action.copymsg' => Optional[Enum['on', 'off']] 20 | }] 21 | -------------------------------------------------------------------------------- /types/inputs/imbatchreports.pp: -------------------------------------------------------------------------------- 1 | # Data type for Rsyslog Input module parameters for batch report inputs. 2 | type Rsyslog::Inputs::Imbatchreports = Struct[{ 3 | reports => String[1], 4 | tag => String[1], 5 | facility => Optional[Stdlib::Syslogfacility], 6 | severity => Optional[Rsyslog::Syslog::Severity], 7 | deduplicatespaces => Optional[Enum['on', 'off']], 8 | delete => Optional[String[1]], 9 | rename => Optional[String[1]], 10 | programkey => Optional[String[1]], 11 | timestampkey => Optional[String[1]], 12 | }] 13 | -------------------------------------------------------------------------------- /types/inputs/imfile.pp: -------------------------------------------------------------------------------- 1 | # Data type for Rsyslog Input module input parameters for file inputs. 2 | type Rsyslog::Inputs::Imfile = Struct[{ 3 | file => String[1], 4 | tag => String[1], 5 | facility => Optional[Stdlib::Syslogfacility], 6 | severity => Optional[Rsyslog::Syslog::Severity], 7 | persiststateinterval => Optional[Integer], 8 | 'startmsg.regex' => Optional[String[1]], 9 | 'endmsg.regex' => Optional[String[1]], 10 | readtimeout => Optional[Integer], 11 | readmode => Optional[Integer[0, 2]], 12 | escapelf => Optional[Enum['on', 'off']], 13 | maxlinesatonce => Optional[Integer], 14 | maxsubmitatonce => Optional[Integer], 15 | deletestateonfiledelete => Optional[Enum['on', 'off']], 16 | ruleset => Optional[String[1]], 17 | addmetadata => Optional[Enum['on', 'off']], 18 | addceetag => Optional[Enum['on', 'off']], 19 | reopenontruncate => Optional[Enum['on', 'off']], 20 | trimlineoverbytes => Optional[Integer], 21 | freshstarttail => Optional[Enum['on', 'off']], 22 | discardtruncatedmsg => Optional[Enum['on', 'off']], 23 | msgdiscardingerror => Optional[Enum['on', 'off']], 24 | neeparse => Optional[Enum['on', 'off']], 25 | }] 26 | -------------------------------------------------------------------------------- /types/inputs/imgssapi.pp: -------------------------------------------------------------------------------- 1 | # Data type for Rsyslog Input module input parameters for gssapi. 2 | type Rsyslog::Inputs::Imgssapi = Struct[{ 3 | inputgssserverrun => Optional[Stdlib::Port], 4 | inputgssserverservicename => Optional[String[1]], 5 | inputgssserverpermitplaintcp => Optional[Enum['on', 'off']], 6 | inputgssservermaxsessions => Optional[Integer], 7 | inputgssserverkeepalive => Optional[Enum['on', 'off']], 8 | inputgsslistenportfilename => Optional[Stdlib::Port], 9 | }] 10 | -------------------------------------------------------------------------------- /types/inputs/imkafka.pp: -------------------------------------------------------------------------------- 1 | # Data type for Rsyslog Input module input parameters for Apache Kafka. 2 | type Rsyslog::Inputs::Imkafka = Struct[{ 3 | broker => Optional[String[1]], 4 | topic => String[1], 5 | confparam => Optional[Array[String[1]]], 6 | consumergroup => Optional[String[1]], 7 | ruleset => Optional[String[1]], 8 | parsehostname => Optional[Enum['on', 'off']], 9 | }] 10 | -------------------------------------------------------------------------------- /types/inputs/improg.pp: -------------------------------------------------------------------------------- 1 | # Data type for Rsyslog Input module input parameters for Program input 2 | type Rsyslog::Inputs::Improg = Struct[{ 3 | binary => String[1], 4 | tag => String[1], 5 | facility => Optional[Stdlib::Syslogfacility], 6 | severity => Optional[Rsyslog::Syslog::Severity], 7 | confirmmessages => Optional[Enum['on', 'off']], 8 | signalonclose => Optional[Enum['on', 'off']], 9 | closetimeout => Optional[Integer], 10 | killunresponsive => Optional[Enum['on', 'off']], 11 | }] 12 | -------------------------------------------------------------------------------- /types/inputs/imptcp.pp: -------------------------------------------------------------------------------- 1 | # Data type for Rsyslog Plain TCP input module 2 | type Rsyslog::Inputs::Imptcp = Struct[{ 3 | port => Optional[Stdlib::Port], 4 | path => Optional[Stdlib::Absolutepath], 5 | discardtruncatedmsg => Optional[Enum['on', 'off']], 6 | fileowner => Optional[String[1]], 7 | fileownernum => Optional[Integer], 8 | filegroup => Optional[String[1]], 9 | filegroupnum => Optional[Integer], 10 | filecreatemode => Optional[Stdlib::Filemode], 11 | failonchownfailure => Optional[Enum['on', 'off']], 12 | unlink => Optional[Enum['on', 'off']], 13 | name => Optional[String[1]], 14 | ruleset => Optional[String[1]], 15 | maxframesize => Optional[Integer], 16 | address => Optional[Stdlib::IP::Address::V4], 17 | addtlframedelimiter => Optional[Integer], 18 | supportoctetcountetframing => Optional[Enum['on', 'off']], 19 | notifyonconnectionclose => Optional[Enum['on', 'off']], 20 | notifyonconnectionopen => Optional[Enum['on', 'off']], 21 | keepalive => Optional[Enum['on', 'off']], 22 | 'keepalive.probes' => Optional[Integer], 23 | 'keepalive.interval' => Optional[Integer], 24 | 'keepalive.time' => Optional[Integer], 25 | 'ratelimit.interval' => Optional[Integer], 26 | 'ratelimit.burst' => Optional[Integer], 27 | 'compression.mode' => Optional[Enum['none', 'single', 'stream:always']], 28 | flowcontrol => Optional[Enum['on', 'off']], 29 | multiline => Optional[Enum['on', 'off']], 30 | 'framing.delimiter.regex' => Optional[String[1]], 31 | socketbacklog => Optional[Integer], 32 | defaulttz => Optional[String[1]], 33 | 'framingfix.cisco.asa' => Optional[Enum['on', 'off']], 34 | listenportfilename => Optional[String[1]], 35 | }] 36 | -------------------------------------------------------------------------------- /types/inputs/imrelp.pp: -------------------------------------------------------------------------------- 1 | # Data type for Rsyslog Plain TCP input module 2 | type Rsyslog::Inputs::Imrelp = Struct[{ 3 | port => Stdlib::Port, 4 | address => Optional[Stdlib::IP::Address::V4], 5 | name => Optional[String[1]], 6 | ruleset => Optional[String[1]], 7 | maxdatasize => Optional[Pattern[/^([0-9]+)[kKmMgGtT]$/]], 8 | tls => Optional[Enum['on', 'off']], 9 | 'tls.compression' => Optional[Enum['on', 'off']], 10 | 'tls.dhbits' => Optional[Integer], 11 | 'tls.permittedpeer' => Optional[Array[String[1]]], 12 | 'tls.authmode' => Optional[Enum['fingerprint', 'name']], 13 | 'tls.cacert' => Optional[String[1]], 14 | 'tls.mycert' => Optional[String[1]], 15 | 'tls.myprivkey' => Optional[String[1]], 16 | 'tls.prioritystring' => Optional[String[1]], 17 | keepalive => Optional[Enum['on', 'off']], 18 | 'keepalive.probes' => Optional[Integer], 19 | 'keepalive.interval' => Optional[Integer], 20 | 'keepalive.time' => Optional[Integer], 21 | oversizemode => Optional[Enum['truncate', 'abort', 'accept']], 22 | }] 23 | -------------------------------------------------------------------------------- /types/inputs/imtcp.pp: -------------------------------------------------------------------------------- 1 | # Data type for Rsyslog TCP input module 2 | type Rsyslog::Inputs::Imtcp = Struct[{ 3 | port => Stdlib::Port, 4 | address => Optional[Stdlib::IP::Address::V4], 5 | name => Optional[String[1]], 6 | ruleset => Optional[String[1]], 7 | supportoctetcountedframing => Optional[Enum['on', 'off']], 8 | 'ratelimit.interval' => Optional[Integer], 9 | 'ratelimit.burst' => Optional[Integer], 10 | listenportfilename => Optional[String[1]], 11 | }] 12 | -------------------------------------------------------------------------------- /types/inputs/imtuxedoulog.pp: -------------------------------------------------------------------------------- 1 | # Data for Rsyslog Input Tuxedo ULOG module 2 | type Rsyslog::Inputs::Imtuxedoulog = Struct[{ 3 | ulogbase => Stdlib::Absolutepath, 4 | tag => String[1], 5 | facility => Optional[Stdlib::Syslogfacility], 6 | severity => Optional[Rsyslog::Syslog::Severity], 7 | persiststateinterval => Optional[Integer], 8 | maxlinesatonce => Optional[Integer], 9 | maxsubmitatonce => Optional[Integer], 10 | }] 11 | -------------------------------------------------------------------------------- /types/inputs/imudp.pp: -------------------------------------------------------------------------------- 1 | # Data type for Rsyslog UDP input module 2 | type Rsyslog::Inputs::Imudp = Struct[{ 3 | address => Optional[Stdlib::Host], 4 | port => Stdlib::Port, 5 | ipfreebind => Optional[Integer[0,2]], 6 | device => Optional[String[1]], 7 | ruleset => Optional[String[1]], 8 | 'ratelimit.interval' => Optional[Integer], 9 | 'ratelimit.burst' => Optional[Integer], 10 | name => Optional[String[1]], 11 | 'name.appendport' => Optional[Enum['on', 'off']], 12 | defaulttz => Optional[String[1]], 13 | rcvbufsize => Optional[Variant[Integer, String[1]]], 14 | }] 15 | -------------------------------------------------------------------------------- /types/inputs/imuxsock.pp: -------------------------------------------------------------------------------- 1 | # Data type for Rsyslog Unix Socket input module 2 | type Rsyslog::Inputs::Imuxsock = Struct[{ 3 | ruleset => Optional[String[1]], 4 | ignoretimestamp => Optional[Enum['on', 'off']], 5 | ignoreownmessages => Optional[Enum['on', 'off']], 6 | flowcontrol => Optional[Enum['on', 'off']], 7 | 'ratelimit.interval' => Optional[Integer], 8 | 'ratelimit.burst' => Optional[Integer], 9 | 'ratelimit.severity' => Optional[Integer[0,7]], 10 | usepidfromsystem => Optional[Enum['on', 'off']], 11 | usesystimestamp => Optional[Enum['on', 'off']], 12 | createpath => Optional[Enum['on', 'off']], 13 | socket => Optional[String[1]], 14 | hostname => Optional[String[1]], 15 | annotate => Optional[Enum['on', 'off']], 16 | parsetrusted => Optional[Enum['on', 'off']], 17 | unlink => Optional[Enum['on', 'off']], 18 | usespecialparser => Optional[Enum['on', 'off']], 19 | parsehostname => Optional[Enum['on', 'off']], 20 | }] 21 | -------------------------------------------------------------------------------- /types/modules/input.pp: -------------------------------------------------------------------------------- 1 | type Rsyslog::Modules::Input = Enum[ 2 | 'im3195', 3 | 'imfile', 4 | 'imgssapi', 5 | 'imjournal', 6 | 'imkafka', 7 | 'imklog', 8 | 'imkmsg', 9 | 'immark', 10 | 'impstats', 11 | 'imptcp', 12 | 'imrelp', 13 | 'imsolaris', 14 | 'imtcp', 15 | 'imupd', 16 | 'imuxsock', 17 | ] 18 | -------------------------------------------------------------------------------- /types/modules/inputs/imdocker.pp: -------------------------------------------------------------------------------- 1 | # Data type for Rsyslog module parameters for imdocker 2 | type Rsyslog::Modules::Inputs::Imdocker = Struct[{ 3 | dockerapiunixsockaddr => Optional[Stdlib::Absolutepath], 4 | apiversionstr => Optional[Pattern[/^v([0-9]+)\.([0-9]+)/]], 5 | pollinginterval => Optional[Integer], 6 | listcontaineroptions => Optional[String[1]], 7 | getcontainerlogoptions => Optional[String[1]], 8 | retrievenewlogsfromstart => Optional[Integer[0,1]], 9 | defaultfacility => Optional[Stdlib::Syslogfacility], 10 | defaultseverity => Optional[Rsyslog::Syslog::Severity], 11 | escapelf => Optional[Enum['on', 'off']], 12 | }] 13 | -------------------------------------------------------------------------------- /types/modules/inputs/imfile.pp: -------------------------------------------------------------------------------- 1 | # Data type for Rsyslog Input module parameters for file inputs. 2 | type Rsyslog::Modules::Inputs::Imfile = Struct[{ 3 | mode => Optional[Enum['inotify', 'polling']], 4 | readtimeout => Optional[Integer], 5 | timeoutgranularity => Optional[Enum['on', 'off']], 6 | sortfiles => Optional[Enum['on', 'off']], 7 | pollinginterval => Optional[Integer], 8 | }] 9 | -------------------------------------------------------------------------------- /types/modules/inputs/imjournal.pp: -------------------------------------------------------------------------------- 1 | # Rsyslog imjournal Module parameter data type 2 | type Rsyslog::Modules::Inputs::Imjournal = Struct[{ 3 | persiststateinterval => Optional[Integer], 4 | statefile => Optional[Stdlib::Absolutepath], 5 | 'ratelimit.interval' => Optional[Integer], 6 | 'ratelimit.burst' => Optional[Integer], 7 | ignorepreviousmessage => Optional[Enum['on', 'off']], 8 | defaultseverity => Optional[Rsyslog::Syslog::Severity], 9 | defaultfacility => Optional[Stdlib::Syslogfacility], 10 | usepidfromsystem => Optional[Enum['on', 'off']], 11 | usepid => Optional[Enum['syslog', 'system', 'both']], 12 | ignorenonvalidstatefile => Optional[Enum['on', 'off']], 13 | workaroundjournalbug => Optional[Enum['on', 'off']], 14 | }] 15 | -------------------------------------------------------------------------------- /types/modules/message.pp: -------------------------------------------------------------------------------- 1 | type Rsyslog::Modules::Message = Enum[ 2 | 'mmanon', 3 | 'mmcount', 4 | 'mmdblookup', 5 | 'mmexternal', 6 | 'mmfields', 7 | 'mmjsonparse', 8 | 'mmkubernetes', 9 | 'mmnormalize', 10 | 'mmpstructdata', 11 | 'mmrfc5424addhmac', 12 | 'mmrm1stspace', 13 | 'mmsequence', 14 | 'mmsnmptrapd', 15 | 'mmutf8fix', 16 | ] 17 | -------------------------------------------------------------------------------- /types/modules/output.pp: -------------------------------------------------------------------------------- 1 | type Rsyslog::Modules::Output = Enum[ 2 | 'omamqp1', 3 | 'omelasticsearch', 4 | 'omfile', 5 | 'omfwd', 6 | 'omhdfs', 7 | 'omhiredis', 8 | 'omhttpfs', 9 | 'omjournal', 10 | 'omkafka', 11 | 'omlibdbi', 12 | 'ommail', 13 | 'ommongodb', 14 | 'ommysql', 15 | 'ompgsql', 16 | 'ompipe', 17 | 'omprog', 18 | 'omrelp', 19 | 'omsnmp', 20 | 'omudpspoof', 21 | 'omusrmsg', 22 | 'omuxsock', 23 | ] 24 | -------------------------------------------------------------------------------- /types/modules/parser.pp: -------------------------------------------------------------------------------- 1 | type Rsyslog::Modules::Parser = Enum[ 2 | 'pmciscoios', 3 | 'pmlastmsg', 4 | 'pmnormalize', 5 | 'pmnull', 6 | 'pmrfc3164', 7 | 'pmrfc3164sd', 8 | 'pmrfc5424', 9 | ] 10 | -------------------------------------------------------------------------------- /types/modules/string.pp: -------------------------------------------------------------------------------- 1 | type Rsyslog::Modules::String = Enum[ 2 | 'smfile', 3 | 'smfwd', 4 | 'smtradfile', 5 | 'smtradfwd', 6 | ] 7 | -------------------------------------------------------------------------------- /types/propertyoperator.pp: -------------------------------------------------------------------------------- 1 | # Enumerable custom type for rsyslog property operators 2 | type Rsyslog::PropertyOperator = Enum[ 3 | 'contains', 4 | 'isequal', 5 | 'startswith', 6 | 'regex', 7 | 'ereregex', 8 | '!contains', 9 | '!isequal', 10 | '!startswith', 11 | '!regex', 12 | '!ereregex', 13 | ] 14 | -------------------------------------------------------------------------------- /types/queue/parameters.pp: -------------------------------------------------------------------------------- 1 | type Rsyslog::Queue::Parameters = Struct[{ 2 | 'queue.filename' => Optional[String[1]], 3 | 'queue.spoolDirectory' => Optional[Stdlib::Absolutepath], 4 | 'queue.size' => Optional[Integer], 5 | 'queue.dequeueBatchSize' => Optional[Integer], 6 | 'queue.maxDiskSpace' => Optional[Integer], 7 | 'queue.highWatermark' => Optional[Integer], 8 | 'queue.lowWatermark' => Optional[Integer], 9 | 'queue.fullDelaymark' => Optional[Integer], 10 | 'queue.lightDelaymark' => Optional[Integer], 11 | 'queue.discardMark' => Optional[Integer], 12 | 'queue.discardSeverity' => Optional[Integer], 13 | 'queue.checkpointInterval' => Optional[Integer], 14 | 'queue.syncqueuefiles' => Optional[Enum['on', 'off']], 15 | 'queue.samplingInterval' => Optional[Integer], 16 | 'queue.type' => Optional[Enum['FixedArray', 'LinkedList', 'Direct', 'Disk']], 17 | 'queue.workerThreads' => Optional[Integer], 18 | 'queue.workerThreadMinimumMessages' => Optional[Integer], 19 | 'queue.timeoutWorkerthreadShutdown' => Optional[Integer], 20 | 'queue.timeoutshutdown' => Optional[Integer], 21 | 'queue.timeoutActionCompletion' => Optional[Integer], 22 | 'queue.timeoutEnqueue' => Optional[Integer], 23 | 'queue.maxFileSize' => Optional[Pattern[/^([0-9]+)(m|M|g|G)$/]], 24 | 'queue.saveOnShutdown' => Optional[Enum['on', 'off']], 25 | 'queue.dequeueSlowDown' => Optional[Integer], 26 | 'queue.dequeueTimeBegin' => Optional[Integer[1, 24]], 27 | 'queue.dequeueTimeEnd' => Optional[Integer[1, 25]], 28 | }] 29 | -------------------------------------------------------------------------------- /types/syslog/severity.pp: -------------------------------------------------------------------------------- 1 | # Syslog severity data type 2 | type Rsyslog::Syslog::Severity = Variant[ 3 | Enum[ 4 | 'emerg', 5 | 'alert', 6 | 'crit', 7 | 'err', 8 | 'warning', 9 | 'notice', 10 | 'info', 11 | 'debug', 12 | ], 13 | Integer[0, 7], 14 | ] 15 | --------------------------------------------------------------------------------