Hi all, we have a .NET API and want to introduce audit logs, which includes two logs per HTTP call: one for request with payload, the other one for response with payload. We have our API running in ECS. What could be the go-to? Is utilizing logging middleware in application to capture requests/responses and sending them to CloudWatch sink a good idea or is there a better approach?
I wouldn’t log sensitive payloads to CloudWatch. It’s a money pit and ACLs are porous. Pipe to Kinesis Firehose then encrypted S3. Middleware will tank your latency anyway.
So many reasons not to log full payloads: security/privacy risk, performance, storage cost, logging noise, retention liability for legal discovery etc. If you really must do this then consider redacting sensitive content.
There is no real costs constraints, but it would be great to optimize costs (enterprise company money). From what I have gathered, for large number of logs CloudWatch isn’t a go-to solution, maybe add a 90-days retention period and then store it to S3. Other solution as per u/Adrienne-Fadel would be to set up a pipe to Kinesis Firehose and then encrypted S3. Then the only question remains how to query those logs but I can investigate that.
The service sits in an isolated PCI-DSS environment with limited AWS services capabilities, although the main services like ECS, S3, EC2, RDS etc. are whitelisted, so it should not be an issue. If needed, there could be a case raised to an IT department.
Data should be used for audit purposes, however, we would still need to access the logs for daily troubleshooting if issues arise.
Hopefully I have answered all of the questions. The requirements are getting refined every day so it’s difficult to give concrete details.
That helps. I’d look into sending the logs to OpenSearch instead of S3. Obviously it’ll be more expensive but the improvement in DevEx for auditing/daily troubleshooting will more than make up for it.