All Projects → takus → fluent-plugin-ec2-metadata

takus / fluent-plugin-ec2-metadata

Licence: other
Fluentd output plugin to add Amazon EC2 metadata into messages

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to fluent-plugin-ec2-metadata

fluent-plugin-grok-parser
Fluentd's Grok parser
Stars: ✭ 100 (+132.56%)
Mutual labels:  fluentd, fluentd-plugin
fluent-plugin-rabbitmq
Fluent input/output plugin for RabbitMQ.
Stars: ✭ 26 (-39.53%)
Mutual labels:  fluentd, fluentd-plugin
fluent-plugin-gcs
Google Cloud Storage output plugin for Fluentd.
Stars: ✭ 39 (-9.3%)
Mutual labels:  fluentd, fluentd-plugin
fluent-plugin-windows-eventlog
Fluentd plugin to collect windows event logs
Stars: ✭ 27 (-37.21%)
Mutual labels:  fluentd, fluentd-plugin
fluent-plugin-multiprocess
Multiprocess agent plugin for Fluentd
Stars: ✭ 42 (-2.33%)
Mutual labels:  fluentd, fluentd-plugin
fluent-plugin-webhdfs
Hadoop WebHDFS output plugin for Fluentd
Stars: ✭ 57 (+32.56%)
Mutual labels:  fluentd, fluentd-plugin
fluent-plugin-http-pull
The input plugin of fluentd to pull log from rest api.
Stars: ✭ 19 (-55.81%)
Mutual labels:  fluentd, fluentd-plugin
fluentd-plugin-mdsd
Azure Linux monitoring agent (mdsd) output plugin for fluentd
Stars: ✭ 26 (-39.53%)
Mutual labels:  fluentd, fluentd-plugin
fluent-plugin-redis
Redis output plugin for Fluent event collector
Stars: ✭ 40 (-6.98%)
Mutual labels:  fluentd, fluentd-plugin
dog
A firewall management system.
Stars: ✭ 67 (+55.81%)
Mutual labels:  ec2
stork
Retrieve tokens from Vault for your EC2 instances.
Stars: ✭ 12 (-72.09%)
Mutual labels:  ec2
ocaml-aws
Generated OCaml bindings for Amazon Web Services
Stars: ✭ 126 (+193.02%)
Mutual labels:  ec2
amazon-ec2-image-builder-samples
Samples for Amazon EC2 Image Builder
Stars: ✭ 103 (+139.53%)
Mutual labels:  ec2
libfluent
Library to send log as fluentd forwarding message
Stars: ✭ 24 (-44.19%)
Mutual labels:  fluentd
efk-stack-helm
Helm chart to deploy a working logging solution using the ElasticSearch - Fluentd - Kibana stack on Kubernetes
Stars: ✭ 51 (+18.6%)
Mutual labels:  fluentd
terraform-ecs
Terraform ECS module
Stars: ✭ 15 (-65.12%)
Mutual labels:  ec2
terraform-aws-ec2
Terraform module to create an EC2 resource on AWS with Elastic IP Addresses and Elastic Block Store.
Stars: ✭ 33 (-23.26%)
Mutual labels:  ec2
terraform-aws-eks-workers
Terraform module to provision an AWS AutoScaling Group, IAM Role, and Security Group for EKS Workers
Stars: ✭ 82 (+90.7%)
Mutual labels:  ec2
logging-operator
A golang based operator to create and manage EFK (Elasticsearch, Fluentd, and Kibana) stack on Kubernetes
Stars: ✭ 42 (-2.33%)
Mutual labels:  fluentd
vault-ec2auth
A simple agent to authenticate an AWS EC2 instance against Hashicorp Vault
Stars: ✭ 12 (-72.09%)
Mutual labels:  ec2

fluent-plugin-ec2-metadata

Gem Version Build Status Test Coverage Code Climate Codacy Badge

Fluentd plugin to add Amazon EC2 metadata fields to a event record

Requirements

fluent-plugin-ec2-metadata fluentd ruby
>= 0.1.0 v0.14.x >= 2.1
0.0.15 <= v0.12.x >= 1.9

Installation

Use RubyGems:

gem install fluent-plugin-ec2-metadata

Configuration

Example:

<match foo.**>
  @type ec2_metadata

  aws_key_id  YOUR_AWS_KEY_ID
  aws_sec_key YOUR_AWS_SECRET/KEY

  metadata_refresh_seconds 300 # Optional, default 300 seconds
  imdsv2 true                  # Optional, default false

  output_tag ${instance_id}.${tag}
  <record>
    hostname      ${tagset_name}
    instance_id   ${instance_id}
    instance_type ${instance_type}
    az            ${availability_zone}
    private_ip    ${private_ip}
    vpc_id        ${vpc_id}
    ami_id        ${image_id}
    account_id    ${account_id}
  </record>
</match>

Assume following input is coming:

foo.bar {"message":"hello ec2!"}

then output becomes as below (indented):

i-28b5ee77.foo.bar {
  "hostname"      : "web0001",
  "instance_id"   : "i-28b5ee77",
  "instance_type" : "m1.large",
  "az"            : "us-west-1b",
  "private_ip     : "10.21.34.200",
  "vpc_id"        : "vpc-25dab194",
  "account_id"    : "123456789",
  "image_id"      : "ami-123456",
  "message"       : "hello ec2!"
}

Or you can use filter version:

<filter foo.**>
  @type ec2_metadata

  aws_key_id  YOUR_AWS_KEY_ID      
  aws_sec_key YOUR_AWS_SECRET/KEY

  metadata_refresh_seconds 300 # Optional, default 300 seconds
  imdsv2 true                  # Optional, default false

  <record>
    hostname      ${tagset_name}
    instance_id   ${instance_id}
    instance_type ${instance_type}
    private_ip    ${private_ip}
    az            ${availability_zone}
    vpc_id        ${vpc_id}
    ami_id        ${image_id}
    account_id    ${account_id}
  </record>
</filter>

Placeholders

The following placeholders are always available:

  • ${tag} input tag
  • ${tag_parts} input tag splitted by '.'. you can use it like ${tag_parts[0]} or ${tag_parts[-1]}
  • ${instance_id} instance id
  • ${instance_type} instance type
  • ${availability_zone} availability zone
  • ${region} region
  • ${private_ip} private ip
  • ${mac} MAC address
  • ${vpc_id} vpc id
  • ${subnet_id} subnet id
  • ${account_id} account id
  • ${image_id} ami image id

The followings are available when you define aws_key_id and aws_sec_key(or define IAM Policy):

  • ${tagset_xxx} EC2 tag (e.g. tagset_name is replaced by the value of Key = Name)

The following is an example for a minimal IAM policy needed to ReadOnlyAccess to EC2.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "ec2:Describe*",
      "Resource": "*"
    },
    {
      "Effect": "Allow",
      "Action": "elasticloadbalancing:Describe*",
      "Resource": "*"
    },
    {
      "Effect": "Allow",
      "Action": [
        "cloudwatch:ListMetrics",
        "cloudwatch:GetMetricStatistics",
        "cloudwatch:Describe*"
      ],
      "Resource": "*"
    },
    {
      "Effect": "Allow",
      "Action": "autoscaling:Describe*",
      "Resource": "*"
    }
  ]
}

Refer to the AWS documentation for example policies. Using IAM roles with a properly configured IAM policy are preferred over embedding access keys on EC2 instances.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].