How Can We Effectively Audit API Calls in a Sensitive Data Environment?

April 17, 2026 4 answers
Asked by cue+the lights!
I'm seeking advice on implementing audit logs for our .NET API, which runs on ECS. We want to log both request and response payloads for each HTTP call. However, since we're dealing with sensitive data, I need to find the best approach. Would using logging middleware to capture requests and responses and then sending them to CloudWatch be a good choice, or is there a better method? Any insights on best practices for handling sensitive information would be greatly appreciated!

Answers

~13 stitches loose
It's generally a bad idea to log sensitive payloads directly to CloudWatch due to security risks and potential costs. Instead, consider piping the logs to Kinesis Firehose and then sending them to an encrypted S3 bucket. This way, you keep the data safe and avoid the high costs of CloudWatch. Plus, using middleware can seriously slow down your API's response time.
Reply to this answer
gutter_14mm
Think about the volume of data youโ€™ll be generating. Are there any budget constraints? Also, how complex is your current architecture? And how do you plan to use this logged data? These questions can really affect your logging strategy.
Reply to this answer
relay_race_fan
Logging full payloads poses several risks, including security, privacy, and storage costs. It can also create legal liabilities for data retention in case of discovery. If you must log these, I highly recommend redacting any sensitive information to mitigate risks.
Reply to this answer
aerial-photo-sorter
If your application is running in ECS, one simple approach is to configure your logs to send everything to STDOUT. This way, the logs will automatically go to CloudWatch like other container events without extra setup.
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions