{"id":20513341,"url":"https://github.com/redbubble/fluent-plugin-annotation-filter","last_synced_at":"2025-03-05T23:13:34.325Z","repository":{"id":46428924,"uuid":"308331683","full_name":"redbubble/fluent-plugin-annotation-filter","owner":"redbubble","description":"Checks whether the container name is included in an annotation on the pod that is the source of a log entry.","archived":false,"fork":false,"pushed_at":"2024-04-30T19:14:53.000Z","size":46,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":23,"default_branch":"main","last_synced_at":"2025-03-02T22:08:24.159Z","etag":null,"topics":["dre","kubernetes"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/fluent-plugin-annotation-filter/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/redbubble.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-29T13:07:24.000Z","updated_at":"2023-09-12T05:16:12.000Z","dependencies_parsed_at":"2024-04-30T20:41:02.994Z","dependency_job_id":null,"html_url":"https://github.com/redbubble/fluent-plugin-annotation-filter","commit_stats":{"total_commits":26,"total_committers":3,"mean_commits":8.666666666666666,"dds":"0.11538461538461542","last_synced_commit":"14cf075748f3c11fa643c56d5d00ce62e4f2b6c1"},"previous_names":["redbubble/fluentd-plugin-annotation-filter"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redbubble%2Ffluent-plugin-annotation-filter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redbubble%2Ffluent-plugin-annotation-filter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redbubble%2Ffluent-plugin-annotation-filter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redbubble%2Ffluent-plugin-annotation-filter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redbubble","download_url":"https://codeload.github.com/redbubble/fluent-plugin-annotation-filter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242117716,"owners_count":20074438,"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":["dre","kubernetes"],"created_at":"2024-11-15T21:10:17.570Z","updated_at":"2025-03-05T23:13:34.293Z","avatar_url":"https://github.com/redbubble.png","language":"Ruby","readme":"# Fluentd Plugin: Kubernetes Annotation Filter\n\nChecks whether the container name is included in an annotation on the pod that is the source of a log entry.\n\n## Development\n\n### Running Locally\n\nIt can be a bit of a challenge to get fluentd running locally for \"poke-it-and-see\" style testing. One approach is to:\n\n1. Get a docker container with fluentd in it\n1. Create an `app/plugins` directory\n1. Copy `lib/fluent/plugin/*` from this repository into that directory\n1. Create a fluentd configuration that uses this plugin, taking input from a file in the `/app` directory. An example\n   configuration can be found at [example/fluentd-test.conf](example/fluentd-test.conf).\n1. Run the container\n1. Put your test lines into the file\n1. Watch the output\n\nThis is not a particularly nice way to develop anything, but it does _work_. You'll then need to copy the modified\nsource code _back_ into this repository.\n\n### Tests\n\nYou can run tests locally with:\n\n```\n\u003e rspec\n```\n\nOr in docker with:\n\n```\n\u003e make test\n```\n\nThe tests are written using Fluent's [Test Driver](https://docs.fluentd.org/plugin-development/plugin-test-code); this\nrequires the `test-unit` gem be included (for some helper methods we're not using) in addition to `rspec`, which is\nactually used to run the tests (in accordance with what all the rest of DRE's Ruby code uses).\n\n## Operations\n\n### Installation\n\nAdd the following to your Gemfile:\n\n```ruby\ngem 'fluent-plugin-annotation-filter'\n```\n\n### Dependencies\n\nThis plugin relies on _Kubernetes metadata_ being available on log records. This metadata is provided by the\n[Kubernetes_metadata_filter](https://github.com/fabric8io/fluent-plugin-kubernetes_metadata_filter) plugin.\n\nSpecifically, we rely on the following fields:\n\n| Field                       | Content                                                        |\n|-----------------------------|----------------------------------------------------------------|\n| `kubernetes.container_name` | The name of the container the record was emitted from          |\n| `kubernetes.annotations`    | The annotations applied to the pod the record was emitted from |\n\n### Configuration\n\nAn example configuration could look like:\n\n```\n\u003cfilter camelid\u003e\n@type kubernetes_annotation\n\n\u003ccontains_container_name\u003e\nannotation dromedary\n\u003c/contains_container_name\u003e\n\u003c/filter\u003e\n```\n\nThis would look for the value of `kubernetes.container_name` in the `kubernetes.annotations.dromedary` field of records\ntagged \"camelid\"; for example, these records would be allowed to pass through the filter:\n\n```\n{\"message\": \"hi\", \"kubernetes\": {\"container_name\": \"beluga\", ..., \"annotations\": { \"dromedary\": \"[\\\"beluga\\\"]\" } } }\n{\"message\": \"wat\", \"kubernetes\": {\"container_name\": \"humpback\", ..., \"annotations\": { \"dromedary\": \"[\\\"minke\\\", \\\"humpback\\\"]\" } } }\n```\n\nbut these ones would not:\n\n```\n{\"message\": \"hi\", \"kubernetes\": {\"container_name\": \"pelican\", ..., \"annotations\": { \"dromedary\": \"[\\\"minke\\\", \\\"humpback\\\"]\" } } }\n{\"message\": \"wat\", \"kubernetes\": {\"container_name\": \"gannet\", ..., \"annotations\": { } } }\n```\n\nNote that the value of the provided annotation is expected to be a _JSON array_ inside a string (this appears to be the\nway people suggest encoding data of this kind).\n\nThe `pass_through_events_without_kubernetes_tags` option can be used to control whether objects without Kubernetes tags\nare passed through the filter or dropped. It defaults to `false`, i.e. drop unmatched objects.\n\n## Maintainers\n\ndelivery-engineers@redbubble.com\n\n    fluentd-plugin-annotation-filter\n\n    Copyright (c) Redbubble\n\n    Permission is hereby granted, free of charge, to any person obtaining\n    a copy of this software and associated documentation files (the\n    \"Software\"), to deal in the Software without restriction, including\n    without limitation the rights to use, copy, modify, merge, publish,\n    distribute, sublicense, and/or sell copies of the Software, and to\n    permit persons to whom the Software is furnished to do so, subject to\n    the following conditions:\n\n    The above copyright notice and this permission notice shall be included\n    in all copies or substantial portions of the Software.\n\n    THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n    IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n    CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n    TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n    SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredbubble%2Ffluent-plugin-annotation-filter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredbubble%2Ffluent-plugin-annotation-filter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredbubble%2Ffluent-plugin-annotation-filter/lists"}