Closed David-Moreira closed 3 years ago
I guess, this should be possible, but I need to check it.
I guess, you're configuring the sink via JSON? This should help you: https://github.com/SeppPenner/SerilogSinkForPostgreSQL/blob/master/HowToUse.md#configuration-via-json-file.
Just a small example that should solve your problem (You need to adjust your other settings like connection string, of course).
{
"Serilog": {
"WriteTo": [
{
"Name": "PostgreSQL",
"Args": {
"connectionString": "User ID=postgres;Password=postgres;Host=localhost;Port=5432;Database=Serilog;",
"tableName": "TestLogs",
"schemaName": null,
"needAutoCreateTable": true,
"loggerColumnOptions": {
"Id": "IdAutoIncrement",
"Message": "RenderedMessage",
"MessageTemplate": "Message",
"Level": "Level",
"created_on": "Timestamp",
"Exception": "Exception",
"LogEvent": "LogEvent"
}
}
}
]
}
}
@SeppPenner Thank you!
Hello, First of all, thank you for keeping the support on this library. Can you change the main properties column names? message, message_template, timestamp, etc
I'd like to change the timestamp column name to created_on, is this possible? I tried smthg like, with no success: "loggerPropertyColumnOptions": { "created_on": { "Name": "Timestamp", "Format": "{0}", "WriteMethod": "Raw", "DbType": "Timestamp" }