aws-lambda-dotnet
aws-lambda-dotnet copied to clipboard
PowerShell Lambda functions should allow logging without a default '[PREFIX]' value
Overview
The current logging implementation for PowerShell Lambda functions (as defined in the PowerShellHost) adds a prefix to all CloudWatch logs depending on the PowerShel stream the log came from. This prevents JSON usage in logs for CloudWatch Logs Metric Filters or for additional downstream services retriving pure JSON log entries.
Perhaps a new standard Environment Variable could be added to prevent this prefix, say DISABLE_LOG_PREFIX
?
Current Behavior:
Lambda Code:
$log = ConvertTo-Json -Compress -InputObject @{
LogType = 'Custom'
Message = 'This is my log message'
}
Write-Verbose -Message $log -Verbose
CloudWatch Logs: [VERBOSE] {"Message":"This is my log message","LogType":"Custom"}
Desired Behavior:
Environment Variable DISABLE_LOG_PREFIX
exists with any non-empty value.
Lambda Code:
$log = ConvertTo-Json -Compress -InputObject @{
LogType = 'Custom'
Message = 'This is my log message'
}
Write-Verbose -Message $log -Verbose
CloudWatch Logs: {"Message":"This is my log message","LogType":"Custom"}
Thanks for the feedback. I also like the idea of some more configuration here.
We have noticed this issue has not received attention in 1 year. We will close this issue for now. If you think this is in error, please feel free to comment and reopen the issue.