Documentation
¶
Overview ¶
Package logsafe scrubs request payloads before they reach a log sink or a trace tag.
Three things happen and the order matters: file content is replaced, then the credentials a pre-signed storage URL carries, then what survives is capped. Truncation alone is not enough, because base64 usually leads the arguments object: the retained head would be the readable start of the file, and the tool name and other parameters would be what got cut.
Index ¶
Constants ¶
const MaxLoggedBytes = 64 << 10
MaxLoggedBytes caps a scrubbed payload. It matches the cap the response writer already applies, so inbound and outbound bodies are treated alike.
Variables ¶
This section is empty.
Functions ¶
func Bytes ¶
Bytes returns b with file content and pre-signed URL credentials replaced, and the result capped.
func ElidedBody ¶
ElidedBody is the placeholder logged in place of a body that is not worth capturing.
func IsTextualContentType ¶
IsTextualContentType reports whether a body of this content type is worth capturing in a log. A pending file upload sends raw bytes, and capturing them would copy the customer's file into the log and hold a second copy in memory for the life of the request.
Types ¶
This section is empty.