{"id":16702930,"url":"https://github.com/vkhatri/chef-filebeat","last_synced_at":"2025-03-21T20:32:07.221Z","repository":{"id":54665635,"uuid":"44762959","full_name":"vkhatri/chef-filebeat","owner":"vkhatri","description":"Chef Cookbook to Manage Elastic Filebeat https://supermarket.chef.io/cookbooks/filebeat","archived":false,"fork":false,"pushed_at":"2021-02-06T21:59:41.000Z","size":335,"stargazers_count":32,"open_issues_count":7,"forks_count":83,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-13T19:06:43.689Z","etag":null,"topics":["beats","chef-cookbook","filebeat","logging"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vkhatri.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-22T17:51:13.000Z","updated_at":"2023-11-09T07:46:40.000Z","dependencies_parsed_at":"2022-08-13T23:11:02.142Z","dependency_job_id":null,"html_url":"https://github.com/vkhatri/chef-filebeat","commit_stats":null,"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vkhatri%2Fchef-filebeat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vkhatri%2Fchef-filebeat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vkhatri%2Fchef-filebeat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vkhatri%2Fchef-filebeat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vkhatri","download_url":"https://codeload.github.com/vkhatri/chef-filebeat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221818290,"owners_count":16885716,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["beats","chef-cookbook","filebeat","logging"],"created_at":"2024-10-12T19:06:36.175Z","updated_at":"2024-10-28T10:44:44.772Z","avatar_url":"https://github.com/vkhatri.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"filebeat Cookbook\n================\n\n[![Cookbook](https://img.shields.io/github/tag/vkhatri/chef-filebeat.svg)](https://github.com/vkhatri/chef-filebeat) [![Build Status](https://travis-ci.org/vkhatri/chef-filebeat.svg?branch=master)](https://travis-ci.org/vkhatri/chef-filebeat)\n\nThis is a [Chef] cookbook to manage [Filebeat].\n\n\u003e\u003e For Production environment, always prefer the [most recent release](https://supermarket.chef.io/cookbooks/filebeat).\n\n## Most Recent Release\n\n```ruby\ncookbook 'filebeat', '~\u003e 2.4.0'\n```\n\n## From Git\n\n```ruby\ncookbook 'filebeat', github: 'vkhatri/chef-filebeat',  tag: 'v2.4.0'\n```\n\n## Repository\n\n```bash\nhttps://github.com/vkhatri/chef-filebeat\n```\n\n## Supported OS\n\n- Windows\n- Amazon Linux\n- CentOS\n- Fedora\n- Ubuntu\n- Debian\n- Mac OSX\n\nAlso works on Solaris zones given a physical Solaris 11.2 server. For that, use the .kitchen.zone.yml file. Check usage at (https://github.com/criticalmass/kitchen-zone). You will need an url to a filebeat package that works on Solaris 11.2. Checkout Building-Filebeat-On-Solaris11.md for instructions to build a filebeat package.\n\n## Supported Chef\n\nThis cookbook is tested against current Chef version. But, the cookbook is known to work with Chef Client version \u003e=12.14.\n\n## Supported Filebeat\n\n- 6.x\n- 7.x\n\n## Cookbook Dependency\n\n- `homebrew`\n- `elastic_repo`\n- `yum-plugin-versionlock`\n- `runit`\n- `windows`\n\n## Recipes\n\n- lwrp_test - LWRP examples recipe\n\n## LWRP Resources\n\n- `filebeat_config` - filebeat configuration resource\n\n- `filebeat_install` - filebeat install resource\n\n- `filebeat_install_preview` - filebeat preview package install resource\n\n- `filebeat_service` - filebeat service resource\n\n- `filebeat_runit_service` - filebeat service resource using runit\n\n- `filebeat_prospector` - filebeat prospector resource (renamed filebeat inputs in version 6.3+)\n\n## Limitations\n\nThe Mac OSX setup only allows for package installs and depends on brew, this means that version selection and preview build installs are not supported.\n\n## LWRP filebeat_install\n\nLWRP `filebeat_install` installs filebeat, creates log/prospectors directories, and also enable filebeat service.\n\nBelow attributes are derived using helper methods and also used by other LWRP.\n\n- `conf_dir`\n- `prospectors_dir`\n- `log_dir`\n\n**LWRP example**\n\n```ruby\nfilebeat_install 'default' do\n  [options ..]\nend\n```\n\n\n**LWRP Options**\n\n- *action* (optional)\t- default `:create`, options: :create, :delete\n- *version* (optional, String)\t- default `6.3.0`, filebeat version\n- *release* (optional, String)\t- default `1`, filebeat release version, used by `rhel` family package resource\n- *setup_repo* (optional, Boolean) - default `true`, set to `false`, to skip elastic repository setup using cookbook `elastic_repo`\n- *ignore_package_version* (optional, Boolean) - default `false`, set to true, to install latest available yum/apt filebeat package\n- *service_name* (optional, String) - default `filebeat`, filebeat service name, must be common across resources\n- *disable_service* (optional, Boolean) - default `false`, set to `true`, to disable filebeat service\n- *notify_restart* (optional, Boolean) - default `true`, set to `false`, to ignore filebeat service restart notify\n- *delete_prospectors_dir* (optional, Boolean) - default `false`, set to `true`, to purge prospectors directory by deleting and recrating prospectors directory\n- *conf_dir* (optional, String, NilClass) - default `nil`, filebeat configuration directory, this attribute is derived by helper method\n- *prospectors_dir* (optional, String, NilClass) - default `nil`, filebeat prospectors directory, this attribute is derived by helper method\n- *log_dir* (optional, String, NilClass) - default `nil`, filebeat log directory, this attribute is derived by helper method\n- *windows_package_url* (optional, String) - default `auto`, windows filebeat package url\n- *windows_base_dir* (optional, String) - default `C:/opt/filebeat`, filebeat windows base directory\n- *apt_options* (optional, Array) - default `%w[stable main]`, filebeat package resource attribute for `debian` platform family\n- *elastic_repo_options* (optional, Hash) - default `{}`, resource elastic_repo options, `filebeat_install` attribute `version` overrides `elasti_repo_options` key `version` value. Check out [elastic_repo cookbook](https://github.com/vkhatri/chef-elastic-repo) for more details.\n\n\n## LWRP filebeat_service\n\nLWRP `filebeat_service` configures `filebeat` service.\n\n\n**LWRP example**\n\n```ruby\nfilebeat_service 'default' do\n  [options ..]\nend\n```\n\n**LWRP Options**\n\n- *action* (optional)\t- default `:create`, options: :create, :delete\n- *filebeat_install_resource_name* (optional, String) - default `default`, filebeat_install/filebeat_install_preview resource name, set this attribute if LWRP resource name is other than `default`\n- *service_name* (optional, String) - default `filebeat`, filebeat service name, must be common across resources\n- *disable_service* (optional, Boolean) - default `false`, set to `true`, to disable filebeat service\n- *purge_prospectors_dir* (optional, Boolean) - default `false`, set to `true`, to purge prospectors\n- *service_ignore_failure* (optional, Boolean) - default `false`, set to `true`, to ignore filebeat service failures\n- *service_retries* (optional, Integer) - default `2`, filebeat service resource attribute\n- *service_retry_delay* (optional, Integer) - default `0`, filebeat service resource attribute\n\n## LWRP filebeat_config\n\nLWRP `filebeat_config` creates filebeat configuration yaml file `/etc/filebeat/filebeat.yml`.\n\nBelow filebeat configuration parameters gets overwritten by the LWRP.\n\n- `filebeat.registry_file`\n- `filebeat.config_dir`\n- `logging.files`\n\n### Filebeat version \u003c 6.0\n\n```ruby\nconf = {\n  'filebeat.modules' =\u003e [],\n  'prospectors' =\u003e [],\n  'logging.level' =\u003e 'info',\n  'logging.to_files' =\u003e true,\n  'logging.files' =\u003e { 'name' =\u003e 'filebeat' },\n  'output.elasticsearch' =\u003e { 'hosts' =\u003e ['127.0.0.1:9200'] }\n}\n\nfilebeat_config 'default' do\n  config conf\n  action :create\nend\n```\n\nAbove LWRP Resource will create a file `/etc/filebeat/filebeat.yml` with content:\n\n```yaml\nfilebeat.modules: []\nprospectors: []\nlogging.level: info\nlogging.to_files: true\nlogging.files:\n  path: \"/var/log/filebeat\"\noutput.elasticsearch:\n  hosts:\n  - 127.0.0.1:9200\nfilebeat.registry_file: \"/var/lib/filebeat/registry\"\nfilebeat.config_dir: \"/etc/filebeat/conf.d\"\n```\n\n### Filebeat version 6.0+\n\n```ruby\nconf = {\n  'filebeat.modules' =\u003e [],\n  'filebeat.inputs' =\u003e [],\n  'logging.level' =\u003e 'info',\n  'logging.to_files' =\u003e true,\n  'logging.files' =\u003e { 'name' =\u003e 'filebeat' },\n  'output.elasticsearch' =\u003e { 'hosts' =\u003e ['127.0.0.1:9200'] }\n}\n\nfilebeat_config 'default' do\n  config conf\n  action :create\nend\n```\n\nAbove LWRP Resource will create a file `/etc/filebeat/filebeat.yml` with content:\n\n```yaml\nfilebeat.modules: []\nprospectors: []\nlogging.level: info\nlogging.to_files: true\nlogging.files:\n  path: \"/var/log/filebeat\"\noutput.elasticsearch:\n  hosts:\n  - 127.0.0.1:9200\nfilebeat.registry_file: \"/var/lib/filebeat/registry\"\nfilebeat.config.inputs:\n  enabled: true\n  path: \"/etc/filebeat/conf.d/*.yml\"\n```\n\n**LWRP Options**\n\n- *action* (optional)\t- default `:create`, options: :create, :delete\n- *filebeat_install_resource_name* (optional, String) - default `default`, filebeat_install/filebeat_install_preview resource name, set this attribute if LWRP resource name is other than `default`\n- *config* (Hash) - default `{}` filebeat configuration options\n- *config_sensitive* (optional, Boolean) - default `false`, filebeat configuration file chef resource attribute\n- *service_name* (optional, String) - default `filebeat`, filebeat service name, must be common across resources\n- *conf_file* (optional, String, NilClass) - default `nil`, filebeat configuration file, this attribute is derived by helper method\n- *disable_service* (optional, Boolean) - default `false`, set to `true`, to disable filebeat service\n- *notify_restart* (optional, Boolean) - default `true`, set to `false`, to ignore filebeat service restart notify\n- *prefix* (optional, String) - default `lwrp-prospector-`, filebeat prospecteor filename prefix, set to '' if no prefix is desired\n\n\n## LWRP filebeat_prospector (inputs)\n\n### Filebeat version up to 6.3\nLWRP `filebeat_prospector` creates a filebeat prospector configuration yaml file under prospectors directory with file name `lwrp-prospector-#{resource_name}.yml`.\n`lwrp-prospector-` prefix can be changed with `prefix` property (see above).\n\n**LWRP example**\n\n```ruby\nconf = {\n  'enabled' =\u003e true,\n  'paths' =\u003e ['/var/log/messages'],\n  'type' =\u003e 'log',\n  'fields' =\u003e {'type' =\u003e 'messages_log'}\n}\n\nfilebeat_prospector 'messages_log' do\n  config conf\n  action :create\n  prefix 'my-custom-prefix-'\nend\n```\n\nAbove LWRP Resource will create a file `/etc/filebeat/conf.d/my-custom-prefix-messages_log.yml` with content:\n\n```yaml\nfilebeat:\n  prospectors:\n  - enabled: true\n    paths:\n    - \"/var/log/messages\"\n    type: log\n    fields:\n      type: messages_log\n```\n\n### Filebeat version 6.3+\n\nWith `filebeat.config.inputs` set, Filebeat 6.3+ will read in the files as previous versions and the same config will work as expected\n\n```ruby\nconf = {\n  'type'    =\u003e 'log',\n  'enabled' =\u003e true,\n  'paths'   =\u003e ['/var/log/messages'],\n  'type'    =\u003e 'log',\n  'fields'  =\u003e {'type' =\u003e 'messages_log'}\n}\n\nfilebeat_prospector 'messages_log' do\n  config conf\n  action :create\nend\n```\n\nthe file is created with content:\n\n```yaml\n- enabled: true\n  paths:\n  - \"/var/log/messages\"\n  type: log\n  fields:\n    type: messages_log\n```\n\n**LWRP Options**\n\n- *action* (optional)\t- default `:create`, options: :create, :delete\n- *filebeat_install_resource_name* (optional, String) - default `default`, filebeat_install/filebeat_install_preview resource name, set this attribute if LWRP resource name is other than `default`\n- *config* (Hash) - default `{}` filebeat configuration options\n- *config_sensitive* (optional, Boolean) - default `false`, filebeat configuration file chef resource attribute\n- *service_name* (optional, String) - default `filebeat`, filebeat service name, must be common across resources\n- *disable_service* (optional, Boolean) - default `false`, set to `true`, to disable filebeat service\n- *notify_restart* (optional, Boolean) - default `true`, set to `false`, to ignore filebeat service restart notify\n\n## LWRP filebeat_runit_service\n\nLWRP `filebeat_runit_service` configures `filebeat` service using `runit`.\n\n\n**LWRP example**\n\n```ruby\nfilebeat_runit_service 'default' do\n  [options ..]\nend\n```\n\n**LWRP Options**\n\n- *action* (optional) - default `:create`, options: :create, :delete\n- *filebeat_install_resource_name* (optional, String) - default `default`, filebeat_install/filebeat_install_preview resource name, set this attribute if LWRP resource name is other than `default`\n- *service_name* (optional, String) - default `filebeat`, filebeat service name, must be common across resources\n- *disable_service* (optional, Boolean) - default `false`, set to `true`, to disable filebeat service\n- *purge_prospectors_dir* (optional, Boolean) - default `false`, set to `true`, to purge prospectors\n- *runit_filebeat_cmd_options* (optional, Boolean) - default `''`, set to `true`, runit filebeat service command line options\n- *service_ignore_failure* (optional, Boolean) - default `false`, set to `true`, to ignore filebeat service failures\n\n\n## How to Create Filebeat LWRP Resources via Node Attribute\n\nCheck out filebeat test cookbook [filebeat_test](test/cookbooks/filebeat_test).\n\n## TODO\n\n- Add other platforms support to install_preview resource\n\n## Contributing\n\n1. Fork the repository on Github\n2. Create a named feature branch (like `add_component_x`)\n3. Write your change\n4. Write tests for your change (if applicable)\n5. Run the tests (`rake \u0026 rake knife`), ensuring they all pass\n6. Write new resource/attribute description to `README.md`\n7. Write description about changes to PR\n8. Submit a Pull Request using Github\n\n## Copyright \u0026 License\n\nAuthors:: Virender Khatri and [Contributors]\n\n\u003cpre\u003e\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\u003c/pre\u003e\n\n[Chef]: https://www.chef.io/\n[Filebeat]: https://www.elastic.co/products/beats/filebeat\n[Contributors]: https://github.com/vkhatri/chef-filebeat/graphs/contributors\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvkhatri%2Fchef-filebeat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvkhatri%2Fchef-filebeat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvkhatri%2Fchef-filebeat/lists"}