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

Add support for custom Flow Logs format #10081

Closed
sshvetsov opened this issue Sep 12, 2019 · 4 comments · Fixed by #10374
Closed

Add support for custom Flow Logs format #10081

sshvetsov opened this issue Sep 12, 2019 · 4 comments · Fixed by #10374
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/ec2 Issues and PRs that pertain to the ec2 service.
Milestone

Comments

@sshvetsov
Copy link

sshvetsov commented Sep 12, 2019

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

AWS has announced support for custom VPC Flow Logs format, which now allows to inclusion of additional metadata fields like vpc-id, subnet-id, instance-id, tcp-flags, type, pkt-srcaddr, pkt-dstaddr in Amazon Virtual Private Cloud (Amazon VPC) flow logs to better understand network flows.

Usage of additional metadata fields like vpc-id, subnet-id, Transmission Control Protocol (TCP) bitmask reduce the number of computations and look-ups required to extract meaningful information from the log data. For example, you can use TCP bitmask to identify the resource initiating at TCP connection. Similarly, you can use the packet source and destination IP fields to identify the source resource and the intended target of a connection passing through a network interface attached to NAT Gateway or an AWS Transit Gateway.

New or Affected Resource(s)

  • aws_flow_log

Potential Terraform Configuration

resource "aws_flow_log" "example" {
  log_destination      = "${aws_s3_bucket.example.arn}"
  log_destination_type = "s3"
  traffic_type    = "ALL"
  vpc_id          = "${aws_vpc.example.id}"
  log_format      = "$${version} $${vpc-id} $${subnet-id} $${instance-id} $${interface-id} $${account-id} $${type} $${srcaddr} $${dstaddr} $${srcport} $${dstport} $${pkt-srcaddr} $${pkt-dstaddr} $${protocol} $${bytes} $${packets} $${start} $${end} $${action} $${tcp-flags} $${log-status}"
}

Note: the use of ${} in flow log configuration format conflicts with Terraform variable interpolation syntax, so there may be a need to use different symbols to denote log metadata attributes and escape them like I did in the above example.

References

@sshvetsov sshvetsov added the enhancement Requests to existing resources that expand the functionality or scope. label Sep 12, 2019
@ghost ghost added the service/ec2 Issues and PRs that pertain to the ec2 service. label Sep 12, 2019
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Sep 12, 2019
@bflad bflad removed the needs-triage Waiting for first response or review from a maintainer. label Oct 10, 2019
@bflad bflad added this to the v2.33.0 milestone Oct 10, 2019
@nywilken nywilken modified the milestones: v2.33.0, v2.34.0 Oct 17, 2019
@bflad
Copy link
Contributor

bflad commented Oct 31, 2019

Support for the new log_format argument in the aws_flow_log resource has been merged and will release with version 2.34.0 of the Terraform AWS Provider, tomorrow. Thanks to @nebi-frame for the implementation. 👍

@bflad
Copy link
Contributor

bflad commented Oct 31, 2019

This has been released in version 2.34.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@jgard
Copy link

jgard commented Nov 7, 2019

Could you also update the doc with an example of the format required here?

@ghost
Copy link

ghost commented Mar 29, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/ec2 Issues and PRs that pertain to the ec2 service.
Projects
None yet
4 participants