Querying events with numeric property

24 views
Skip to first unread message

Wahid Shalaly

unread,
Sep 30, 2014, 3:40:29 AM9/30/14
to get...@googlegroups.com
Hi Nick,

I'm evaluating Seq on a dev machine & it works fine as expected.
I have only one issue, I couldn't understand why, if you can help.

I'm using Serilog & structured event data & I've a property ApplicationId of type long.

Query1: Has(ApplicationId) succeeds & returns all expected events.

Query2: ApplicationId > 635476917451915299 succeeds & returns expected events.
Query3: ApplicationId < 635476917451915301 succeeds & returns expected events.

Query4: ApplicationId == 635476917451915300 returns nothing! (this is why I wrote Query 1 & 2 & 3)
Query5: ApplicationId > 635476917451915299 && ApplicationId < 635476917451915301 returns nothing also!

Moreover, I noticed that examples are for queries with string values, isn't numeric values supported too?

Thanks & regards,
Wahid Shalaly

Note: I'm running latest stable version at the moment (1.4.12)

nblum...@nblumhardt.com

unread,
Sep 30, 2014, 5:19:04 AM9/30/14
to get...@googlegroups.com
Hi Wahid,

Thanks for getting in touch; this is a bit of a strange one! I've tested all of the above on my machine successfully against version 1.4.12, so I don't think the problem is exactly as it seems (yes, Seq supports numeric data throughout).

I'd guess there's some other error occurring; you may find an exception in C:\ProgramData\Seq\Logs - although any errors in queries are usually reported to the UI.

If you can find the event that you expect to match, expand it and click the "Raw JSON" link, this will extract a JSON representation of the event. If you can post it here (redacted as necessary) that may also generate some ideas.

Many thanks,
Nick

Wahid Shalaly

unread,
Oct 2, 2014, 3:20:40 AM10/2/14
to get...@googlegroups.com

Hi Nick,

Thanks for reply. I checked logs & it looks fine.
I checked the "Raw JSON" & I found a clue for what's the problem.

In the following, you can see an event with ApplicationId equals 635476923356034800.


While, in the Raw JSON, ApplicationId equals 635476923356034756.0

This is due to converting large numbers (15+ digits) to JavaScript
JavaScript loses precision after certain limit. (I found this example to show the problem: http://jsfiddle.net/EYjjX/)

If I query Seq with ApplicationId == 635476923356034756.0, I'll receive records correctly, although it'll show 635476923356034800 everywhere!

There are Big Numbers libraries in JavaScript, it could be the solution.
I forked the example above & fixed it using BigNumber.js

Cheers,
Wahid

nblum...@nblumhardt.com

unread,
Oct 2, 2014, 7:13:32 AM10/2/14
to get...@googlegroups.com
Aha! Brilliant sleuthing - thanks Wahid :)

Wahid Shalaly

unread,
Oct 2, 2014, 11:13:33 PM10/2/14
to get...@googlegroups.com
You welcome :) 

Thanks for taking a note. I understand that it might be an edge case & not urgent for everyone.

Cheers
Reply all
Reply to author
Forward
0 new messages