diff --git a/README.md b/README.md index c0f7fb1..9aa8b58 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,31 @@ class { 'winlogbeat': }, }, } +``` +To ship files to [elasticsearch cloud](https://www.elastic.co/guide/en/beats/winlogbeat/current/configure-cloud-id.html): +```puppet +class { 'winlogbeat': + # must be 6 or above to be recognized by winlogbeat + major_version => '7', + package_ensure => '7.9.0', + cloud => { + id => 'YOUR_CLOUD_ID', + auth => 'elastic:YOUR_CLOUD_AUTH' + }, + outputs => { + 'elasticsearch' => { + #overridden by cloud.id and cloud.auth + 'hosts' => [ + 'http://localhost:9200', + ], + 'index' => 'winlogbeat', + 'cas' => [ + '/etc/pki/root/ca.pem', + ], + }, + }, +} ``` To ship log files through [logstash](https://www.elastic.co/guide/en/beats/winlogbeat/current/logstash-output.html): @@ -73,7 +97,6 @@ class { 'winlogbeat': }, }, } - ``` [Shipper](https://www.elastic.co/guide/en/beats/winlogbeat/current/configuration-shipper.html) and [logging](https://www.elastic.co/guide/en/beats/winlogbeat/current/configuration-logging.html) options can be configured the same way, and are documented on the [elastic website](https://www.elastic.co/guide/en/beats/winlogbeat/current/index.html). diff --git a/manifests/config.pp b/manifests/config.pp index d2b7176..83c80d6 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -11,6 +11,7 @@ 'metrics' => $winlogbeat::metrics, 'event_logs' => $winlogbeat::event_logs_final, }, + 'cloud' => $winlogbeat::cloud, 'output' => $winlogbeat::outputs, 'shipper' => $winlogbeat::shipper, 'logging' => $winlogbeat::logging, diff --git a/manifests/init.pp b/manifests/init.pp index a122ac1..dc22c76 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -16,6 +16,7 @@ # @param service_ensure [String] The ensure parameter on the winlogbeat service (default: running) # @param service_enable [String] The enable parameter on the winlogbeat service (default: true) # @param registry_file [String] The registry file used to store positions, absolute or relative to working directory (default .winlogbeat.yml) +# @param cloud [Hash] Will be converted to YAML to create the optional cloud section of the winlogbeat config # @param outputs [Hash] Will be converted to YAML for the required outputs section of the winlogbeat config # @param shipper [Hash] Will be converted to YAML to create the optional shipper section of the winlogbeat config # @param logging [Hash] Will be converted to YAML to create the optional logging section of the winlogbeat config @@ -34,6 +35,7 @@ $service_provider = $winlogbeat::params::service_provider, $registry_file = $winlogbeat::params::registry_file, $config_file = $winlogbeat::params::config_file, + $cloud = $winlogbeat::params::cloud, $outputs = $winlogbeat::params::outputs, $shipper = $winlogbeat::params::shipper, $logging = $winlogbeat::params::logging, diff --git a/manifests/params.pp b/manifests/params.pp index 6024498..f7ae4da 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -7,6 +7,7 @@ $max_procs = undef $fields = {} $fields_under_root = false + $cloud = {} $outputs = {} $shipper = {} $logging = {} diff --git a/templates/winlogbeat5.yml.erb b/templates/winlogbeat5.yml.erb index 00e5920..cd778f5 100644 --- a/templates/winlogbeat5.yml.erb +++ b/templates/winlogbeat5.yml.erb @@ -115,6 +115,17 @@ max_procs: <%= @winlogbeat_config['max_procs'] %> #- add_cloud_metadata: # +#================================ Cloud ====================================== +<%- if @winlogbeat_config['cloud'] != nil -%> +cloud: + <%- if @winlogbeat_config['cloud']['id'] != nil -%> + id: "<%= @winlogbeat_config['cloud']['id'] %>" + <%- end -%> + <%- if @winlogbeat_config['cloud']['auth'] != nil -%> + auth: "<%= @winlogbeat_config['cloud']['auth'] %>" + <%- end -%> +<%- end -%> + #================================ Outputs ====================================== <%- if @winlogbeat_config['output']['elasticsearch'] != nil -%>