{"id":18110379,"url":"https://github.com/takus/fluent-plugin-ec2-metadata","last_synced_at":"2025-04-06T05:16:47.919Z","repository":{"id":13190882,"uuid":"15874489","full_name":"takus/fluent-plugin-ec2-metadata","owner":"takus","description":"Fluentd output plugin to add Amazon EC2 metadata into messages","archived":false,"fork":false,"pushed_at":"2021-11-12T20:57:05.000Z","size":87,"stargazers_count":43,"open_issues_count":7,"forks_count":28,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-04-24T16:10:20.400Z","etag":null,"topics":["aws","ec2","fluentd","fluentd-plugin"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/takus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-01-13T16:41:39.000Z","updated_at":"2023-05-30T12:42:23.000Z","dependencies_parsed_at":"2022-08-25T15:40:26.801Z","dependency_job_id":null,"html_url":"https://github.com/takus/fluent-plugin-ec2-metadata","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takus%2Ffluent-plugin-ec2-metadata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takus%2Ffluent-plugin-ec2-metadata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takus%2Ffluent-plugin-ec2-metadata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takus%2Ffluent-plugin-ec2-metadata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/takus","download_url":"https://codeload.github.com/takus/fluent-plugin-ec2-metadata/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247436286,"owners_count":20938533,"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":["aws","ec2","fluentd","fluentd-plugin"],"created_at":"2024-11-01T00:08:48.938Z","updated_at":"2025-04-06T05:16:47.893Z","avatar_url":"https://github.com/takus.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fluent-plugin-ec2-metadata\n\n[![Gem Version](https://badge.fury.io/rb/fluent-plugin-ec2-metadata.svg)](http://badge.fury.io/rb/fluent-plugin-ec2-metadata)\n[![Build Status](https://travis-ci.org/takus/fluent-plugin-ec2-metadata.svg?branch=master)](https://travis-ci.org/takus/fluent-plugin-ec2-metadata)\n[![Test Coverage](https://codeclimate.com/github/takus/fluent-plugin-ec2-metadata/badges/coverage.svg)](https://codeclimate.com/github/takus/fluent-plugin-ec2-metadata/coverage)\n[![Code Climate](https://codeclimate.com/github/takus/fluent-plugin-ec2-metadata/badges/gpa.svg)](https://codeclimate.com/github/takus/fluent-plugin-ec2-metadata)\n[![Codacy Badge](https://api.codacy.com/project/badge/grade/16f6786edb554f1ea7462353808011d6)](https://www.codacy.com/app/takus/fluent-plugin-ec2-metadata)\n\n[Fluentd](http://fluentd.org) plugin to add Amazon EC2 metadata fields to a event record\n\n## Requirements\n\n| fluent-plugin-ec2-metadata | fluentd    | ruby   |\n|--------------------|------------|--------|\n|  \u003e= 0.1.0            | v0.14.x | \u003e= 2.1 |\n|  0.0.15 \u003c=            | v0.12.x | \u003e= 1.9 |\n\n## Installation\nUse RubyGems:\n\n    gem install fluent-plugin-ec2-metadata\n\n## Configuration\n\nExample:\n\n    \u003cmatch foo.**\u003e\n      @type ec2_metadata\n\n      aws_key_id  YOUR_AWS_KEY_ID\n      aws_sec_key YOUR_AWS_SECRET/KEY\n\n      metadata_refresh_seconds 300 # Optional, default 300 seconds\n      imdsv2 true                  # Optional, default false\n\n      output_tag ${instance_id}.${tag}\n      \u003crecord\u003e\n        hostname      ${tagset_name}\n        instance_id   ${instance_id}\n        instance_type ${instance_type}\n        az            ${availability_zone}\n        private_ip    ${private_ip}\n        vpc_id        ${vpc_id}\n        ami_id        ${image_id}\n        account_id    ${account_id}\n      \u003c/record\u003e\n    \u003c/match\u003e\n\nAssume following input is coming:\n\n```\nfoo.bar {\"message\":\"hello ec2!\"}\n```\n\nthen output becomes as below (indented):\n\n```\ni-28b5ee77.foo.bar {\n  \"hostname\"      : \"web0001\",\n  \"instance_id\"   : \"i-28b5ee77\",\n  \"instance_type\" : \"m1.large\",\n  \"az\"            : \"us-west-1b\",\n  \"private_ip     : \"10.21.34.200\",\n  \"vpc_id\"        : \"vpc-25dab194\",\n  \"account_id\"    : \"123456789\",\n  \"image_id\"      : \"ami-123456\",\n  \"message\"       : \"hello ec2!\"\n}\n```\n\nOr you can use filter version:\n\n    \u003cfilter foo.**\u003e\n      @type ec2_metadata\n\n      aws_key_id  YOUR_AWS_KEY_ID      \n      aws_sec_key YOUR_AWS_SECRET/KEY\n\n      metadata_refresh_seconds 300 # Optional, default 300 seconds\n      imdsv2 true                  # Optional, default false\n\n      \u003crecord\u003e\n        hostname      ${tagset_name}\n        instance_id   ${instance_id}\n        instance_type ${instance_type}\n        private_ip    ${private_ip}\n        az            ${availability_zone}\n        vpc_id        ${vpc_id}\n        ami_id        ${image_id}\n        account_id    ${account_id}\n      \u003c/record\u003e\n    \u003c/filter\u003e\n\n### Placeholders\n\nThe following placeholders are always available:\n\n* ${tag} input tag\n* ${tag_parts} input tag splitted by '.'. you can use it like `${tag_parts[0]}` or `${tag_parts[-1]}`\n* ${instance_id} instance id\n* ${instance_type} instance type\n* ${availability_zone} availability zone\n* ${region} region\n* ${private_ip} private ip\n* ${mac} MAC address\n* ${vpc_id} vpc id\n* ${subnet_id} subnet id\n* ${account_id} account id\n* ${image_id} ami image id\n\nThe followings are available when you define `aws_key_id` and `aws_sec_key`(or define IAM Policy):\n\n* ${tagset_xxx} EC2 tag (e.g. tagset_name is replaced by the value of Key = Name)\n\nThe following is an example for a minimal IAM policy needed to ReadOnlyAccess to EC2.\n\n```\n{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Effect\": \"Allow\",\n      \"Action\": \"ec2:Describe*\",\n      \"Resource\": \"*\"\n    },\n    {\n      \"Effect\": \"Allow\",\n      \"Action\": \"elasticloadbalancing:Describe*\",\n      \"Resource\": \"*\"\n    },\n    {\n      \"Effect\": \"Allow\",\n      \"Action\": [\n        \"cloudwatch:ListMetrics\",\n        \"cloudwatch:GetMetricStatistics\",\n        \"cloudwatch:Describe*\"\n      ],\n      \"Resource\": \"*\"\n    },\n    {\n      \"Effect\": \"Allow\",\n      \"Action\": \"autoscaling:Describe*\",\n      \"Resource\": \"*\"\n    }\n  ]\n}\n```\n\nRefer to the [AWS documentation](http://docs.aws.amazon.com/IAM/latest/UserGuide/ExampleIAMPolicies.html) for example policies.\nUsing [IAM roles](http://docs.aws.amazon.com/IAM/latest/UserGuide/WorkingWithRoles.html) with a properly configured IAM policy are preferred over embedding access keys on EC2 instances.\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakus%2Ffluent-plugin-ec2-metadata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftakus%2Ffluent-plugin-ec2-metadata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakus%2Ffluent-plugin-ec2-metadata/lists"}