简体   繁体   中英

Serilog .write(logevent) using mssqlserver sink

Am reading log data (created using serilog from other apps) from a message queue (using rabbitmq) & want to write these to sql server table using serilog mssqlserver sink in a windows service.

Am attempting to go about this using the .Write(LogEvent) method in the serilog api.

Am struggling on the following parameters to populate from the data in the queue:

  • LogEventLevel level
  • IEnumerable <LogEventProperty> properties

Does anyone have a nice example of how to use this method with above params?

When you write the events to the message queue, use CompactJsonFormatter to create the JSON, from https://github.com/serilog/serilog-formatting-compact .

Then, to read them back out as Serilog events, use LogEventReader from https://github.com/serilog/serilog-formatting-compact-reader .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM