filebeats
Version information
This version is compatible with:
- Puppet Enterprise 2018.1.x, 2017.3.x, 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
- Puppet >= 4.0 < 6.0
Start using this module
Add this module to your Puppetfile:
mod 'hetzner-filebeats', '2.1.1'
Learn more about managing modules with a PuppetfileDocumentation
Filebeats
Table of Contents
- Description
- Setup - The basics of getting started with filebeats
- Usage - Configuration options and additional functionality
- Reference - An under-the-hood peek at what the module is doing and how
- Limitations - OS compatibility, etc.
- Development - Guide for contributing to the module
Description
Very simple puppet module to install and configure elasticsearch filebeats.
Setup
puppet module install hetzner-filebeats
Setup Requirements
Puppet labs APT module version 2.3.0 >=
Puppet labs STDLIB module version 4.6.0 >= 5.0.0
Beginning with filebeats
Use puppet module install function to install module and simply include it from your enc/profile/role/site.pp.
Usage
The module can be called with the following parameters:
#inputs
OPTIONAL
An array of hashes that specifies which groups of inputs (formally known as prospectors) log entries the filebeats application must export. This value should be used if you wish to have more than one prospector.
#logstash_hosts
An array of strings that specifies remote hosts to use for logstash outputs, e.g ['localhost:5044'] If left empty then all other logstash options are ignored
#logstash_bulk_max_size
A Number representing the maximum number of events to bulk in a single Logstash request, e.g 2048 Setting this to zero or negative disables the splitting of batches.
#logstash_index
A string that specifies the index to use for the logstash output, defaults to '[filebeat-]YYYY.MM.DD' as per the package.
#logstash_ssl_certificate_authorities
An array of Strings that specifies paths to Certificate authority files when connecting to logstash.
#logstash_ssl_certificate
A String that specifies a path to your hosts certificate to use when connecting to logstash.
#logstash_ssl_certificate_key
A String that specifies a path to your hosts certificate key to use when connecting to logstash.
#logstash_ttl
A String that specifies the Time To Live for a connection to Logstash, you must use a elastic duration e.g. '5m', '1h', '45s' see https://www.elastic.co/guide/en/beats/libbeat/master/config-file-format-type.html#_duration NOTE: this option explicitly disables pipelining, it is not compatible with the async logstash client https://www.elastic.co/guide/en/beats/filebeat/current/logstash-output.html#_literal_ttl_literal
#logstash_worker
A integer that specifies the number of workers participating in the load balancing
#logstash_loadbalance
A boolean to turn on or off load balancing for logstash outputs, defaults to false.
#elasticsearch_hosts
A array containing the hostname/s of your elasticsearch host/s used for send the transactions directly to Elasticsearch by using the Elasticsearch HTTP API. If left empty then all other elasticsearch options are ignored
#elasticsearch_proxy_host
A string containing the hostname of your proxy host used for load balancing your cluster.
#elasticsearch_username
The username filebeats should use to authenticate should your cluster make use of shield
#elasticsearch_password
The password filebeats should use to authenticate should your cluster make use of shield
#elasticsearch_protocol
A string containing the protocol used by filebeats, defaults to http.
#elasticsearch_index
A string that specifies the index to use for the elasticsearch output, defaults to '[filebeat-]YYYY.MM.DD' as per the package.
#elasticsearch_ilm
A boolean that specifies whether to enable Elastic's ILM option, defaults to false
#elasticsearch_ssl_certificate_authorities
An array of Strings that specifies paths to Certificate authority files.
#elasticsearch_ssl_certificate
A String that specifies a path to your hosts certificate to use when connecting to elasticsearch.
#elasticsearch_ssl_certificate_key
A String that specifies a path to your hosts certificate key to use when connecting to elasticsearch.
#elasticsearch_template_enabled
A boolean that allows you to overwrite template loading.
#elasticsearch_template_name
A string that specifies the index template to use for setting mappings in Elasticsearch.
#elasticsearch_template_overwrite
A boolean that allows you to overwrite the existing template.
#elasticsearch_template_path
A string that specifies the path to the template file
#export_log_paths
An array of Strings that specifies which logs the filebeats application must export.
#ilm_check_exits
A boolean when set to false, disables the check for an existing lifecycle policy. The default is true. You need to disable this check if the Filebeat user connecting to a secured cluster doesn’t have the read_ilm privilege
#ilm_enabled
A string that Enables or disables index lifecycle management on any new indices created by Filebeat. Valid values are true, false, and auto (because auto is also an option, this can be a puppet Boolean)
#ilm_overwrite
A boolean when set to true, the lifecycle policy is overwritten at startup
#ilm_pattern
A string that specifies the rollover index pattern. Date math is supported in this setting
#ilm_policy_file
A string that specifies the path to a JSON file that contains a lifecycle policy configuration. Use this setting to load your own lifecycle policy
#ilm_policy_name
A string that specifies the name to use for the lifecycle policy
#ilm_rollover_alias
A string that specifies the index lifecycle write alias name
#log_settings
A puppet Hash containing log level ('debug', 'warning', 'error' or 'critical'), to_syslog(true/false), path('/var/log/filebeat'), keepfiles(7), rotateeverybytes(10485760), name(filebeats.log)
#service_bootstrapped
A boolean to turn on or off the filebeat service at boot ('false'/'true'), defaults to 'true'
#service_state
A string to describe the state of the filebeats service ('stopped'/'running'), defaults to 'running'
Example
Auth.log being exported with elasticsearch out requiring a user and password.
class { 'filebeats':
export_log_paths => ['/var/log/auth.log'],
elasticsearch_username => 'host',
elasticsearch_password => 'secret',
elasticsearch_host => ['elasticsearchproxy.myserver.com'],
}
Multiple inputs with multiple log files being exported to multiple logstash hosts.
class { 'filebeats':
inputs => [{ 'input_type' => 'log',
'doc_type' => 'log',
'paths' => ['/var/log/auth.log'],
'include_lines' => "['sshd','passwd','vigr']",
},
{ 'input_type' => 'log',
'doc_type' => 'apache',
'paths' => ['/var/log/apache2/access.log', '/var/log/apache2/error.log'],
'fields' => {'level' => 'debug', 'review' => 1},
'exclude_lines' => "['warning'']",
}
]
logstash_hosts => ['logstash1.domain.com', 'logstash2.domain.com'],
logstash_loadbalance => true,
}
Hiera data example
filebeats::inputs:
- input_type: 'log'
paths:
- '/var/log/auth.log'
doc_type: 'auth'
include_lines: ['sshd','passwd','vigr']
- input_type: 'log'
paths:
- '/var/log/my_app.log'
doc_type: 'my_app'
exclude_lines: ['warning']
- input_type: 'log'
paths:
- '/var/log/security.log'
doc_type: 'security'
fields:
level: 'debug'
review: 1
- input_type: 'log'
paths:
- '/var/log/app.json'
tags: ['json']
json_keys_under_root: true
json_overwrite_keys: true
json_add_error_key: true
json_message_key: 'log'
Reference
Package
Configures the apt resrouce for filebeats.
Config
Configures the filebeats.yml file.
Service
Ensures the service is running.
Params
Specifies defaults for the installation and configuration
Limitations
Does not support all options available to filebeats configuration.
If you're running a Filebeat version lower than 7.x, e.g 6.8.10. You need to install the pre-v7.x
release in order for the module
to be compatible - https://github.com/xneelo/hetzner-filebeats/releases
If you're running Filebeat version 7 and up, release 2.0.0 and newer is supported.
Development
All pull requests are welcome. This module was just created for our use and functionality will be added as we require it.
2.1.1 (2021-02-03)
NFR: Add license (apache 2.0)
2.1.0 (2020-11-25)
Add support configuring filebeat ilm
Filebeat 7.0 sets ilm on by default so we need to be able to configure this, the new config options are:
- setup.ilm.enabled
- setup.ilm.rollover_alias
- setup.ilm.pattern
- setup.ilm.policy_name
- setup.ilm.policy_file
- setup.ilm.check_exits
- setup.ilm.overwrite
2.0.1 (2020-11-20)
Minor tweak to enable/disable module
- Only attempt to enable if it is disabled, only disable if it is enabled
2.0.0 (2020-11-03)
Major version change 6.x => 7.x
1.0.4 (2019-12-09)
Ensure Apt update runs before package installation
- Credit to Thodoris Sotiropoulos - theosotr
2019-06-28 - Release 1.0.3
Summary
NFR: Fix README format
2019-06-27 - Release 1.0.2
Summary
Add support for the following config options to logstash output
- ttl
- bulk_max_size
2019-04-25 - Release 1.0.0
Summary
Update input type setting in filebeats configuration to conform to 6.X syntax
2018-08-16 - Release 0.3.0
Summary
Update both logstash output and elasticsearch output for filebeat 5.X syntax
- Rename params to reflect which filebeat output they affect
- Typecast all params
- Expand elasticsearch output support with templates and ssl
- Add support for prospector fields
- tags
- Support JSON messages with the following options
json.keys_under_root
json.add_error_key
json.message_key
json.add_error_key
Credit to https://github.com/hundredacres
2017-09-17 - Release 0.2.5
Summary
Remove unintended blank line in filebeats.yml
2017-06-05 - Release 0.2.4
Summary
Add exclude_line config option
2017-06-05 - Release 0.2.3
Summary
Add include_line config option
2017-02-03 - Release 0.2.2
Summary
Add bootstrapping of filebeat service
2017-02-03 - Release 0.2.1
Summary
Support puppetlabs apt module 2.3
- Bump dependency on puppetlabs apt
2017-02-02 - Release 0.1.6
Summary
Add support for prospector fields
- Added new prospector option, fields
- Thanks for the contribution @belskiiartem
2015-04-13 - Release 0.1.5
Summary
Adding logstash output
- Added new parameters for logstash output
- Added param to specify index to ship for both elasticsearch and logstash
- Added service_state param to allow for overriding
- Added loadbalancing param for logstash output
2015-04-08 - Release 0.1.4
Summary
Fix documentation issues
- Minor indetation in documentation
2015-04-08 - Release 0.1.3
Summary
Fix documentation issues
- Fix code examples in README, still trying to get a hang of this
2015-04-08 - Release 0.1.2
Summary
Fix documentation issues
- Fix code examples in README
2015-04-07 - Release 0.1.1
Summary
Minor update to include multiple prospectors
- This update allows for an array of hashes to configure multiple prospectors
- This includes setting of input_type and document type in each hash
2015-04-06 - Release 0.1.0
Summary
First major release with tested (on our environment) log exporting
- Added logging options for filebeats
2015-04-01 - Release 0.0.13
Summary
- Minor bug fixes
- Added TLS/SSL support
- Added protocol option
2015-03-24 - Release 0.0.9
Summary
First working release of basic puppet filebeats module
- This version only included very basic funcionality for installing and configuring file beats on Debian Wheezy
- Fixed minor resource ordering issues
- Fixed some typos in the filebeat template
- Fixed service notify errors
- Added shield username and password options
Dependencies
- puppetlabs-stdlib (>= 4.13.0 < 5.0.0)
- elastic-elastic_stack (>= 6.0.2 < 7.0)
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright 2020-present, Xneelo (Pty) Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.