Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Figure out how to collect AWS VPC Flow logs using Amazon Data Firehose #89

Open
zmoog opened this issue Jun 6, 2024 · 3 comments
Open

Comments

@zmoog
Copy link
Owner

zmoog commented Jun 6, 2024

Goal

Suppose I own an AWS account, and I want to export AWS VPC Flow log events from AWS to an Elastic cluster.

Context

What are the VPC Flow logs?

Requirements & Limitations

  • Supports Elastic Cloud (EC) deployments only
  • The EC deployment must be on AWS (deployments on Azure or GCP are not supported yet)
  • Does not support AWS PrivateLink yet (but it's coming soon)

Preparation

  • Install the latest AWS integration on your Elastic cluster

Steps

  • Overview
  • Create a Firehose stream
  • Create a flow log that publishes to Amazon Data Firehose
  • Verify

Overview

image

Resources

@zmoog
Copy link
Owner Author

zmoog commented Jul 23, 2024

Create a Firehose stream

We need a Firehose stream to collect the VPC Flow logs and send them to a data stream on an Elastic stack.

To create a Firehose stream, you can use the instructions at Monitor Amazon Web Services (AWS) with Amazon Data Firehose up to step 3.

However, you must set two things differently.

  • Name
  • Parameters

Name

Pick a name for your Firehose stream.

Parameters

Use the following parameters:

Name Value
es_datastream_name logs-aws.vpcflow-default

If you're publishing flow logs to a different account, create the required IAM roles, as described in IAM roles for cross account delivery.

@zmoog
Copy link
Owner Author

zmoog commented Jul 23, 2024

Create a flow log that publishes to Amazon Data Firehose

CleanShot 2024-07-24 at 01 38 53@2x

  • For Filter, specify the type of traffic to log.

    • Accept – Log only accepted traffic
    • Reject – Log only rejected traffic
    • All – Log accepted and rejected traffic
  • For Maximum aggregation interval, choose the maximum period of time during which a flow is captured and aggregated into one flow log record.

  • For Destination, choose either of the following options:

    • Send to Amazon Data Firehose in the same account – The delivery stream and the resource to monitor are in the same account.
    • Send to Amazon Data Firehose in a different account – The delivery stream and the resource to monitor are in different accounts.
  • For Amazon Data Firehose stream name, choose the delivery stream that you created.

  • [Cross account delivery only] For IAM roles, specify the required roles (see IAM roles for cross account delivery).

  • For Log record format, specify the format for the flow log record.

    • To use the default flow log record format, choose AWS default format.
    • To create a custom format, choose Custom format. For Log format, choose the fields to include in the flow log record.
  • For Additional metadata, select if you want to include metadata from Amazon ECS in the log format.

  • (Optional) Choose Add tag to apply tags to the flow log.

  • Choose Create flow log.

@zmoog
Copy link
Owner Author

zmoog commented Jul 24, 2024

Verify

Now, the network interface / VPC / subnet you set up is sending the VPC flow logs to the Firehose data stream, which is forwarding them to the Elasticsearch cluster.

Here are the VPC flow logs in the logs-aws.vpcflow-default data stream using Discover and Log Explorer:

image

CleanShot 2024-07-24 at 02 01 31@2x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant