chore(derive/http): change log level when packets are malformed #3780
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
1. Explain what the PR does
Deriving a net packet event for HTTP when given a malformed request/response would previously return an error. This error is useless for users as there always exists a chance for packet corruption when passing through the eBPF perf buffer. As such, log in WARN level instead.
2. Explain how to test it
Before
![image](https://private-user-images.githubusercontent.com/22661609/292867594-6f2536a6-2657-49d2-b11b-b9c3cf0a2b96.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjAxMDIzMzAsIm5iZiI6MTcyMDEwMjAzMCwicGF0aCI6Ii8yMjY2MTYwOS8yOTI4Njc1OTQtNmYyNTM2YTYtMjY1Ny00OWQyLWIxMWItYjljM2NmMGEyYjk2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MDQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzA0VDE0MDcxMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTBjODIzZmRlODMzYzg5Nzc2YWI4Nzg0MmY5YWYxMzNjZDJmY2M0Y2JlNzY2YTc5YTk2OWVkNjUyNDBiMzA1ODgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.SKybER1nImkEQprPrf1kQb1rMnz2ylzvxcS4iqJ0Blw)
net_packet_helpers.go:632
add the following line:Then compile and note the logs working.
tracee --events net_packet_http_request
{"level":"warn","ts":1703593308.6970172,"msg":"attempted to derive net_packet_http_request event from malformed packet, event will be skipped","error":"invalid method \"G\\x00T\""}