Open mdaneri opened 2 months ago
Looking at Get-PodeLoggingSysLogMethod
, I'd say that Splunk and LogInsight would better being their own separate log methods - they share some common parameters with syslog (server, port, etc.), but they don't use/send the syslog format.
Ie, On New-PodeLoggingMethod
, new switches for:
-Splunk
- using the Server, Port, Token, and Hostname params-LogInsight
- using the Server, Port, and Id paramsAnd then move them out of Get-PodeLoggingSysLogMethod
, and into Splunk/LogInsight specific functions. This would open the doors for Azure Log Analytics, AWS Cloudwatch, DataDog, and others too down the line.
For -FailureAction
, I actually like this param, and I'm wondering if instead of being syslog specific we allow it for all method types 🤔. This means the HandleFailure
would be best as its own function rather than a child function.
In terms of Splunk/LogInsight using the REST API, I've no issues - in fact I was going to do this for Azure Log Analytics. However, the methods will need to handle batch logging, more so if the REST API supports sending multiple logs in one request, rather than a single log at a time. There's an example of batch logs in Get-PodeLoggingEventViewerMethod
, where the $item
can either be a single item or an array - if you convert it to an array each time you can simply iterate over all items, or send them in bulk.
Splunk was also raised a while back, and one recommendation was also the REST API; in fact, the example there an yours are basically the same 😄
I've done a quick scan of the code, and can't immediately see anything concerning with the code changes. I've a couple questions, but I'll see if I answer them myself when a review properly.
Only one thing I did spot was the removal of the dd/MMM/yyyy:HH:mm:ss zzz
format. I'm happy with the DateFormat parameter, but this date formatting needs adding back in for the Request logging as it's the format expected by the Combined Log Format - and would also make it a breaking change :)
For compatibility I can set that as default format
i 'm going to add additional options to support common log format and extended log format for the access log
I'm considering a new approach to improve the performance of our methods by utilizing runspaces. Specifically, I plan to:
Remove the following line of code:
$null = Invoke-PodeScriptBlock -ScriptBlock $method.ScriptBlock -Arguments $_args -UsingVariables $logger.Method.UsingVariables -Splat
Replace it with a queue for each method to better manage execution.
Additionally, I've noticed that the current logging mechanism is too heavy and slow. To address this, I propose making the writer methods asynchronous, ensuring they operate independently from each other and the rest of the code.
Almost done. what is missing is the remove of a log and some doc update
Description:
This PR introduces new features to the Pode logging system, adding support for Syslog and Restful logging methods. The following new functions have been added:
Enable-PodeMainLogging
Enable-PodeGeneralLogging
Disable-PodeMainLogging
Disable-PodeGeneralLogging
Additionally,
the New-PodeLoggingMethod function now supports two new type: Syslog and Restful. Write-PodeLog now has been improved
New Features:
Here is an example of how to configure multiple logging output methods: