{"id":16961067,"url":"https://github.com/ricsanfre/ansible-role-fluentbit","last_synced_at":"2026-05-04T23:39:18.369Z","repository":{"id":46825546,"uuid":"413480396","full_name":"ricsanfre/ansible-role-fluentbit","owner":"ricsanfre","description":"Ansible role for installing and configuring fluentbit","archived":false,"fork":false,"pushed_at":"2023-06-03T10:28:20.000Z","size":33,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-26T11:12:18.120Z","etag":null,"topics":["ansible","ansible-role","fluentbit","logging"],"latest_commit_sha":null,"homepage":"https://galaxy.ansible.com/ricsanfre/fluentbit","language":"Jinja","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ricsanfre.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-04T15:28:43.000Z","updated_at":"2023-08-16T17:14:02.000Z","dependencies_parsed_at":"2024-10-13T22:51:00.620Z","dependency_job_id":"3ed7487c-e349-4b23-a9aa-ad6a6e255351","html_url":"https://github.com/ricsanfre/ansible-role-fluentbit","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricsanfre%2Fansible-role-fluentbit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricsanfre%2Fansible-role-fluentbit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricsanfre%2Fansible-role-fluentbit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricsanfre%2Fansible-role-fluentbit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ricsanfre","download_url":"https://codeload.github.com/ricsanfre/ansible-role-fluentbit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244825024,"owners_count":20516586,"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":["ansible","ansible-role","fluentbit","logging"],"created_at":"2024-10-13T22:50:55.386Z","updated_at":"2026-05-04T23:39:13.347Z","avatar_url":"https://github.com/ricsanfre.png","language":"Jinja","funding_links":[],"categories":[],"sub_categories":[],"readme":"Ansible Role: Fluentbit\n=========\n\nFluentbit installation and configuration role.\n\n\nRequirements\n------------\n\nNone.\n\n\nRole Variables\n--------------\n\nAvailable variables are listed below along with default values (see `defaults\\main.yaml`)\n\nDefault configuration of this role keeps most of default configuration file created by fluent-bit package installation. It only removes default INPUT (cpu monitoring) and OUTPUT (stdout) sections.\n\nYou can find more information about each option in the Fluentbit [documentation](https://docs.fluentbit.io/manual/administration/configuring-fluent-bit/configuration-file).\n\n\n### General configuration variables\n\n* **fluentbit_service_flush_seconds**: Flush time in seconds [default: 5]\n* **fluentbit_service_enable_metrics**: Enable metrics HTTP server [default: false]\n* **fluentbit_service_log_level**: Set logging verbosity level [default: info]\n\n### Data pipelines configuration\n\nFor configuring INPUT, FILTER and OUTPUT section within fluentbit configuration the following variables are used \n\n* **fluentbit_inputs**: Fluentbit INPUT configuration section [default: \"\"].\n* **fluentbit_filters**: Fluentbit FILTER configuration section [default: \"\"].\n* **fluentbit_outputs**: Fluentbit OUTPUT configuration section [default: \"\"].\n\n\nUsing that variables the config file content can be added using using yaml `|` operator\n\n```yml\nfluentbit_inputs: |\n  [INPUT]\n      name tail\n      tag auth\n      path /var/log/auth.log\n      path_key log_file\n      DB /run/fluent-bit-auth.state\n      Parser syslog-rfc3164\n  [INPUT]\n      name tail\n      tag syslog\n      path /var/log/syslog\n      path_key log_file\n      DB /run/fluent-bit-syslog.state\n      Parser syslog-rfc3164\n```\n\n\n### Parsers configuration\n\nDefault package fluent-bit installation comes with a predefined set of parsers included as part of `parsers.conf` file. Additional configuration files containing parsers can be added to fluent-bit configuration. This role uses `custom_parser.conf` file for keeping additional custom parsers.\n\nContent of this custom parser file can be configured using the variable `fluentbit_custom_parsers`\n\n```yml\nfluentbit_custom_parsers: |\n  [PARSER]\n      Name syslog-rfc3164-nopri\n      Format regex\n      Regex /^(?\u003ctime\u003e[^ ]* {1,2}[^ ]* [^ ]*) (?\u003chost\u003e[^ ]*) (?\u003cident\u003e[a-zA-Z0-9_\\/\\.\\-]*)(?:\\[(?\u003cpid\u003e[0-9]+)\\])?(?:[^\\:]*\\:)? *(?\u003cmessage\u003e.*)$/\n      Time_Key time\n      Time_Format %b %d %H:%M:%S\n      Time_Keep False\n```\n\n\n### Lua filters and lua script support\n\nLua Filter allows you to modify the incoming records using custom Lua Scripts. See fluentbit [documentation](https://docs.fluentbit.io/manual/pipeline/filters/lua)\n\nLua filter can be included in `fluentbit_filters` variable\n\n```yml\nfluentbit_filters: |\n  [FILTER]\n      Name lua\n      Match host.*\n      script /etc/fluent-bit/adjust_ts.lua\n      call local_timestamp_to_UTC\n```\nLua scripts used by the filters need to be configured using `fluentbit_lua_scripts` role variable. This variable is a list of dictionaries with 2 fields:\n- `name`: name of the lua script\n- `content`: script content)\n\nScript content can be populated from a file using ansible [`lookup` plugin](https://docs.ansible.com/ansible/latest/plugins/lookup.html).\n\n```yml\nfluentbit_lua_scripts:\n  - name: adjust_ts.lua\n    content: \"{{ lookup('template','templates/adjust_ts.lua') }}\"\n\n```\nand `templates/adjust_ts.lua` file content:\n\n```lua\nfunction local_timestamp_to_UTC(tag, timestamp, record)\n    local utcdate   = os.date(\"!*t\", ts)\n    local localdate = os.date(\"*t\", ts)\n    localdate.isdst = false -- this is the trick\n    utc_time_diff = os.difftime(os.time(localdate), os.time(utcdate))\n    return 1, timestamp - utc_time_diff, record\nend\n```\n\n\u003e NOTE: all lua scripts will be copied to `/etc/fluent-bit` directory\n\nDependencies\n------------\n\nNone\n\nExample Playbooks\n-----------------\n\n```yml\n- name: Fluent-bit-installation\n  hosts: all\n  become: true\n  gather_facts: true\n\n  roles:\n    - role: ricsanfre.fluentbit\n      fluentbit_service_enable_metrics: true\n      # lua scripts\n      fluentbit_lua_scripts:\n        - name: adjust_ts.lua\n          content: \"{{ lookup('template','templates/adjust_ts.lua') }}\"\n      # inputs\n      fluentbit_inputs: |\n        [INPUT]\n            Name tail\n            Tag host.*\n            DB /run/fluentbit-state.db\n            Path /var/log/auth.log,/var/log/syslog\n            Parser syslog-rfc3164-nopri\n      # filters\n      fluentbit_filters: |\n        [FILTER]\n            Name lua\n            Match host.*\n            script /etc/fluent-bit/adjust_ts.lua\n            call local_timestamp_to_UTC\n      # outputs\n      fluentbit_outputs: |\n        [OUTPUT]\n            Name stdout\n            Match *\n      # Parsers\n      fluentbit_custom_parsers: |\n        [PARSER]\n            Name syslog-rfc3164-nopri\n            Format regex\n            Regex /^(?\u003ctime\u003e[^ ]* {1,2}[^ ]* [^ ]*) (?\u003chost\u003e[^ ]*) (?\u003cident\u003e[a-zA-Z0-9_\\/\\.\\-]*)(?:\\[(?\u003cpid\u003e[0-9]+)\\])?(?:[^\\:]*\\:)? *(?\u003cmessage\u003e.*)$/\n            Time_Key time\n            Time_Format %b %d %H:%M:%S\n            Time_Keep False\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fricsanfre%2Fansible-role-fluentbit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fricsanfre%2Fansible-role-fluentbit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fricsanfre%2Fansible-role-fluentbit/lists"}