datalust / seq-api

HTTP API client for Seq
https://datalust.co/seq
Apache License 2.0
77 stars 21 forks source link

Is it possible to page queries using the 'clef' parameter? #84

Closed wjrogers closed 4 years ago

wjrogers commented 4 years ago

I am using the technique suggested in #56 to query events as CLEF. This is really useful because I can easily parse the events back into LogEvent and re-log them to the console. Also, it matches the format of the "Stream" endpoint, so I can combine the two to get history + "follow" new events for the same query.

However, I noticed that the results of a clef query may be incomplete, and there is no structured result object to tell me it's "Partial". I checked the HTTP response headers, too, but didn't see anything helpful. Is there any way to detect whether the response from a clef=true API query is a partial result?

As a possible work-around, is there any existing method to convert between EventEntity and LogEvent or CLEF format?

nblumhardt commented 4 years ago

Hi Will - thanks for the note.

At the moment, no, unfortunately - the CLEF format doesn't include enough information to allow for paging.

Converting EventEntity to LogEvent is done in: https://github.com/datalust/seqcli/blob/dev/src/SeqCli/Cli/Commands/SearchCommand.cs#L111

There are a few small supporting types/functions in there you'd need to copy, but the implementation should be fairly robust (probably belongs in a library somewhere 😅 ).

Hope this helps!

wjrogers commented 4 years ago

Yes, that is helpful. Thanks!

Exposing that conversion method would be a nice feature 😄. Maybe you could add an X-Seq-Status header to HTTP responses, too? Nice to haves. I can work with this!