You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unlike Seq, this library uses DateTime/DateTimeOffset at runtime (instead of 100-nanosecond ticks), so numeric comparisons like >= don't work with these values.
A quick way to enable these today would be to add a Ticks() function:
Ticks(@t) >= Ticks(Now())
The next problem is the 1h, there's no support for this right now but adding an Hours() function would cover it:
Ticks(@t) >= Ticks(Now()) - Ticks(Hours(1))
All a bit clunky, though. I'm not sure whether DateTime comparisons are applicable enough to the core use case of this library to justify all of the implementation challenges we'd hit trying to plug them in, but worth sketching things out 🤔
OK thanks for the pointers 😄
For me consuming the library it has its use case to help with filtering/searching logs when using the raw API but for most users consuming this library to filter out logs by including or excluding with dates probably does not make sense.
I may do a draft PR so we can collaborate to at least discuss ideas and approach by writing my own functions
Then you can decide if it makes sense to include it or not
nblumhardt
changed the title
How to work with Timestamp & Dates ?
Functions/literals for working with DateTime, DateTimeOffset, and TimeSpanMay 10, 2022
Hi @nblumhardt 👋
Is it possible that Serilog.Expressions works or already supports working with Timestamp and dates?
Such as some shown in the SEQ Cheatsheet
@Timestamp >= Now() - 1h
to get the last log items in the last hourOr how would you get logs between a specific range of times ?
Look forward to hearing how this could be done or not.
Cheers,
Warren 😄
The text was updated successfully, but these errors were encountered: