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 additional logging for BHP fault #4394

Merged
merged 1 commit into from
Oct 12, 2024
Merged

Add additional logging for BHP fault #4394

merged 1 commit into from
Oct 12, 2024

Conversation

harishxr
Copy link
Contributor

@harishxr harishxr commented Oct 11, 2024

Summary

This PR adds additional logging to the start and stop functions for the BHP fault.

Implementation details

Additional logging statements are added.

Testing

Logging for starting black hole port fault

level=debug time=2024-10-11T20:03:04Z msg="Handling http request" from="172.31.10.171:52002" method="POST"
level=info time=2024-10-11T20:03:04Z msg="Received new request for request type: start network-blackhole-port" request="{\"Protocol\":\"tcp\",\"TrafficType\":\"egress\",\"Port\":1234}" requestType="start network-blackhole-port" tmdsEndpointContainerID="b8f5fb69-ea5b-4dbf-b925-d90ee7b8ad07"
level=debug time=2024-10-11T20:03:04Z msg="Found route" Route={Ifindex: 2 Dst: <nil> Src: 172.31.10.171 Gw: 172.31.0.1 Flags: [] Table: 254 Realm: 0}
level=debug time=2024-10-11T20:03:04Z msg="Found the associated network interface by the index" LinkName="ens5" LinkIndex=2
level=info time=2024-10-11T20:03:04Z msg="Obtained default network interface name on host" taskARN="arn:aws:ecs:us-west-2:817190723229:task/harishxr-ecs/f941ed202d964d7a9c3e3539d8df0f67" defaultDeviceName="ens5"
level=info time=2024-10-11T20:03:04Z msg="Black hole port fault is not running" netns="host" command="iptables -w 5 -C egress-tcp-1234 -p tcp --dport 1234 -j DROP" output="iptables: Bad rule (does a matching rule exist in that chain?).\n" taskArn="arn:aws:ecs:us-west-2:817190723229:task/harishxr-ecs/f941ed202d964d7a9c3e3539d8df0f67" exitCode=1
level=info time=2024-10-11T20:03:04Z msg="Attempting to start network black hole port fault" netns="host" chain="egress-tcp-1234" taskArn="arn:aws:ecs:us-west-2:817190723229:task/harishxr-ecs/f941ed202d964d7a9c3e3539d8df0f67"
level=info time=2024-10-11T20:03:04Z msg="Successfully created new chain" command="iptables -w 5 -N egress-tcp-1234" output="" taskArn="arn:aws:ecs:us-west-2:817190723229:task/harishxr-ecs/f941ed202d964d7a9c3e3539d8df0f67"
level=info time=2024-10-11T20:03:04Z msg="Successfully appended new rule to iptable chain" command="iptables -w 5 -A egress-tcp-1234 -p tcp --dport 1234 -j DROP" output="" taskArn="arn:aws:ecs:us-west-2:817190723229:task/harishxr-ecs/f941ed202d964d7a9c3e3539d8df0f67"
level=debug time=2024-10-11T20:03:04Z msg="Storage stats not reported for container" module=utils_unix.go
level=info time=2024-10-11T20:03:04Z msg="Successfully inserted chain into built-in iptable" insertTable="OUTPUT" taskArn="arn:aws:ecs:us-west-2:817190723229:task/harishxr-ecs/f941ed202d964d7a9c3e3539d8df0f67" command="iptables -w 5 -I OUTPUT -j egress-tcp-1234" output=""
level=info time=2024-10-11T20:03:04Z msg="Successfully started fault" requestType="start network-blackhole-port" request="{\"Port\":1234,\"Protocol\":\"tcp\",\"TrafficType\":\"egress\"}" response="{\"Status\":\"running\"}"
level=info time=2024-10-11T20:03:04Z msg="The telemetry middleware is complete" StatusCode=200 DurationInMs=7 Request="/api/b8f5fb69-ea5b-4dbf-b925-d90ee7b8ad07/fault/v1/network-blackhole-port/start"

Logging for stopping black hole port fault

level=debug time=2024-10-11T20:03:24Z msg="Handling http request" method="POST" from="172.31.10.171:59558"
level=info time=2024-10-11T20:03:24Z msg="Received new request for request type: stop network-blackhole-port" request="{\"Protocol\":\"tcp\",\"TrafficType\":\"egress\",\"Port\":1234}" requestType="stop network-blackhole-port" tmdsEndpointContainerID="b8f5fb69-ea5b-4dbf-b925-d90ee7b8ad07"
level=debug time=2024-10-11T20:03:24Z msg="Successfully parsed fault request payload" request="{\"Port\":1234,\"Protocol\":\"tcp\",\"TrafficType\":\"egress\"}"
level=debug time=2024-10-11T20:03:24Z msg="Found route" Route={Ifindex: 2 Dst: <nil> Src: 172.31.10.171 Gw: 172.31.0.1 Flags: [] Table: 254 Realm: 0}
level=debug time=2024-10-11T20:03:24Z msg="Found the associated network interface by the index" LinkName="ens5" LinkIndex=2
level=info time=2024-10-11T20:03:24Z msg="Obtained default network interface name on host" defaultDeviceName="ens5" taskARN="arn:aws:ecs:us-west-2:817190723229:task/harishxr-ecs/f941ed202d964d7a9c3e3539d8df0f67"
level=info time=2024-10-11T20:03:24Z msg="Black hole port fault has been found running" netns="host" command="iptables -w 5 -C egress-tcp-1234 -p tcp --dport 1234 -j DROP" output="" taskArn="arn:aws:ecs:us-west-2:817190723229:task/harishxr-ecs/f941ed202d964d7a9c3e3539d8df0f67"
level=info time=2024-10-11T20:03:24Z msg="Attempting to stop network black hole port fault" taskArn="arn:aws:ecs:us-west-2:817190723229:task/harishxr-ecs/f941ed202d964d7a9c3e3539d8df0f67" netns="host" chain="egress-tcp-1234"
level=info time=2024-10-11T20:03:24Z msg="Successfully cleared iptable chain" output="" taskArn="arn:aws:ecs:us-west-2:817190723229:task/harishxr-ecs/f941ed202d964d7a9c3e3539d8df0f67" command="iptables -w 5 -F egress-tcp-1234"
level=debug time=2024-10-11T20:03:24Z msg="Storage stats not reported for container" module=utils_unix.go
level=info time=2024-10-11T20:03:24Z msg="Successfully deleted chain from table" insertTable="OUTPUT" taskArn="arn:aws:ecs:us-west-2:817190723229:task/harishxr-ecs/f941ed202d964d7a9c3e3539d8df0f67" command="iptables -w 5 -D OUTPUT -j egress-tcp-1234" output=""
level=info time=2024-10-11T20:03:24Z msg="Successfully deleted chain" taskArn="arn:aws:ecs:us-west-2:817190723229:task/harishxr-ecs/f941ed202d964d7a9c3e3539d8df0f67" command="iptables -w 5 -X egress-tcp-1234" output=""
level=info time=2024-10-11T20:03:24Z msg="Successfully stopped fault" requestType="stop network-blackhole-port" request="{\"Port\":1234,\"Protocol\":\"tcp\",\"TrafficType\":\"egress\"}" response="{\"Status\":\"stopped\"}"
level=info time=2024-10-11T20:03:24Z msg="The telemetry middleware is complete" StatusCode=200 DurationInMs=188 Request="/api/b8f5fb69-ea5b-4dbf-b925-d90ee7b8ad07/fault/v1/network-blackhole-port/stop"

New tests cover the changes: no

Description for the changelog

Add additional logging for BHP fault

Additional Information

Does this PR include breaking model changes? If so, Have you added transformation functions?

Does this PR include the addition of new environment variables in the README?

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@harishxr harishxr requested a review from a team as a code owner October 11, 2024 18:41
mye956
mye956 previously approved these changes Oct 11, 2024
@harishxr harishxr merged commit a15681b into aws:dev Oct 12, 2024
40 checks passed
amogh09 pushed a commit to amogh09/amazon-ecs-agent that referenced this pull request Oct 23, 2024
@mye956 mye956 mentioned this pull request Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants