Logging client log output a NoDB using a WebService

122 views Asked by At

I've a WPF application that runs on an intranet and al communications to the DBs are done via REST webservices. Since for audit purpose I need to store users activities (logs from Information to Fatal logs) to a NoDb instance (Seq or RavenDB). I've seen this thread and seems to do a part of the job. How can I send those information to Seq /RavenDB? do they expose API?

Another question is about reliability, what's the best approach in your opinion to have a reduntant/balanced audit webservice? It's best to have a configuration that doesn't require too much effort

Thanks

1

There are 1 answers

0
Nicholas Blumhardt On

1) If you need to use web services, your web service can post events to Seq via HTTP/S - API docs are at: http://docs.getseq.net/docs/posting-raw-events (batching events is highly recommended in this scenario).

2) If you can avoid the literal interpretation of "web service" and instead just stand up another HTTP endpoint on the server that exposes the web services, you can install Seq to listen at a URL prefix like https://my-server/seq, which allows other services to listen on other endpoints like https://my-server/... Documentation on setting this up is here: http://docs.getseq.net/docs/storage-paths-and-urls#section-the-listen-uri

3) Again in the case of Seq, if you're sending events via Serilog you can set up two Seq servers and log to both of them:

.WriteTo.Seq("https://primary-seq")
.WriteTo.Seq("https://backup-seq")

In this case all of your log searching etc. would need to take place on the primary instance, as configuration data (permissions and so-on) wouldn't be replicated between them.

You might also consider using the bufferBaseFilename for one or both connections, which will buffer events locally to a file so that some server downtime is tolerated.

If your auditing requirements are transactional however (i.e. legal/compliance), you should probably still consider writing these inside regular transactions to your SQL database, if you have one.