Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

conversion of xml to json #413

Answered by ckadluba
jobou363 asked this question in Q&A
Discussion options

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.

You must be logged in to vote

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

Comment options

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.

You must be logged in to vote
1 reply
Comment options

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.

Comment options

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).

You must be logged in to vote
0 replies
Answer selected by ckadluba
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /