datalust/seq-api

List events in the CLEF format

Closed this issue · 2 comments

I'm using the InSignalAsync method to list existing events.

What I need is to get the events in the CLEF (compact JSON format) similarly to how StreamAsync returns them.

I can't find any way how to do that. Any recommendations?

Cheers.

Hi Tom, thanks for the post. Just thinking back to this, there's no direct wrapper API for it, but the following should work (with appropriate parameters):

var connection = new SeqConnection("http://localhost:5341");
var events = await connection.LoadResourceGroupAsync("Events");

// Available params are: signal, filter, count, startAtId, afterId, fromDateUtc, toDateUtc, shortCircuitAfter, render, clef, permalinkId
var clef = connection.Client.GetStringAsync(events, "InSignal", new Dictionary<string, object>
{
    ["signal"] = "signal-1,signal-20",
    ["filter"] = "@Level = 'Error'",
    ["count"] = 5,
    ["clef"] = true,
});

Let me know if you have success with it!

Hi Nicholas,

Thank you for your help, this worked very well!

I used it in conjunction with the clef-tool to move some events between Seq instances, and I managed to accomplish what I needed.