-
Notifications
You must be signed in to change notification settings - Fork 147
-
I wan to use the JSON LogEvent instead of the XML Properties.
I'm wondering if there is a way to convert existing data in the XML Properties column to the JSON LogEvent.
Beta Was this translation helpful? Give feedback.
All reactions
I'm afraid you cannot do conversion directly with the sink. What you can do though are custom formatters. Have a look at the formatters feature described in the Serilog main repo documentation and also on our sample CustomLogEventFormatterDemo (https://github.com/serilog-mssql/serilog-sinks-mssqlserver/tree/dev/sample/CustomLogEventFormatterDemo).
Replies: 2 comments 1 reply
-
If I understand this correct, you want existing data persisted in a table to be converted to JSON. The sink cannot do such a thing since it only writes data to the SQL database but never reads any.
Beta Was this translation helpful? Give feedback.
All reactions
-
I understand that the sink only writes i will try to implement a solution to export xml and reimport on my own.
My problem is that XML take too much space so i'm looking for alternative such using JSON are using specific column instead but since all my log are in xml and not in JSON i need a way to convert the existing xml to the json.
Beta Was this translation helpful? Give feedback.
All reactions
-
I'm afraid you cannot do conversion directly with the sink. What you can do though are custom formatters. Have a look at the formatters feature described in the Serilog main repo documentation and also on our sample CustomLogEventFormatterDemo (https://github.com/serilog-mssql/serilog-sinks-mssqlserver/tree/dev/sample/CustomLogEventFormatterDemo).
Beta Was this translation helpful? Give feedback.