SEQ: structured logging not implemented
I'd really like to use SEQ as logging target. It fails for every Write-Log command, because there is a problem in serializing the JSON, which I already fixed here: https://github.com/acsdatasystems/Logging/commit/c0980fa72b3275038638704edfc48c02310d6733 but haven't merged yet.
With these changes, logs are coming to the SEQ server. But it seems, that there isn't implemented any structured logging. How can I get the original log message? E.g.
Write-Log -Message "Hello {0}!" -Arguments "PowerShell"
in that case I would need Hello {0}! instead of Hello PowerShell!. I would need that, because I have to send a JSON to the server where the message cannot contain the value, but only a key and the value for that key somewhere else.
{
"Events": [
{
"MessageTemplate": "Hello {Who}!",
"Timestamp": "2020-05-29T16:46:09.3034428+02:00",
"Level": null,
"Properties": {
"Who": "World"
}
}
]
}
The passed $Log variable doesn't seem to contain such a message template. Is there another way to get the original template?
Right now we cannot implement strucuterd logging (although I'd like it) cause the form Write-Log -Message 'Hello, {0}!' -Arguments 'Powershell' uses powershell string formatting and doesn't work on named parameters (the {Who}).
We need to write our custom string formatting to propagate the raw string down to the logging target.
@EsOsO How is the current status, I could add the feature next week.
Please go on, I didn't write anything yet.
Hey @tosoikea, have you been able to implement this?