17 Jan 2025
12:18 PM
- last edited on
20 Jan 2025
07:05 AM
by
MaciejNeumann
Hi everyone, I am building a dashboard to monitor a specific feature within our systems, responding to various clients: a website, an Android app and an iPhone app.
I need to filter the dashboard results depending on the client, but also on the app version.
All of my logs have both the client and appversion objects correctly mapped.
Here is my dashboard query:
fetch logs
| filter xxxxxxxx
| parse content, "JSON:json"
| fieldsAdd
client = json[client],
appversion = json[appversion]
| filter in(client, $OS)
| filter in(appversion, $appversion)
Dashboard filters work perfectly fine for the client filter, for both Android and iOS.
Now, the appversion filter works fine for the Android versions, but it does not work for the iOS ones.
The Android app versions are of this format: 14.50.0 - Build 438034, and the iOS app versions of this one: 1569.
Example from a log query:
When using the filter for iOS versions, the dashboard tells me there are no records, when for Android yes.
In order to "debug", I use the log query directly, out of dashboard:
fetch logs
| filter xxxxxxxx
| parse content, "JSON:json"
| fieldsAdd
client = json[client],
appversion = json[appversion]
| filter in(client, {"ios_app"})
| filter in(appversion, {1569})
This does not return any result, so I tried the same query, but passing the iOS app version as a string:
fetch logs
| filter xxxxxxxx
| parse content, "JSON:json"
| fieldsAdd
client = json[client],
appversion = json[appversion]
| filter in(client, {"ios_app"})
| filter in(appversion, {"1569"})
And this does return the expected results.
Now, how to apply the same treatment to the parametrized query for the dashboard?
Ideally, my variable is based on a Query to fetch all the app versions in use.
However, I tried a custom list, using both CSV and Code, to setup the String type, as follow:
export default async function () {
return ["1569", "14.50.0 - Build 438034"]
}
And once I setup the filter, it keeps working for the Android version, but still not for the iOS one. I don't understand what is causing the query to not return results for the iOS app version filtered. (Yes, I triple checked that I do have logs when filtering for this app version). My idea was that the Android app versions are explicitly of String type, but the iOS ones are interpreted as Int since they are numbers. But even forcing it to String does not solve the issue.
Any idea?
21 Jan 2025 01:11 AM
Hey @bobish
Just tested this in an environment and the only reason I could find that the query might be failing is that the value from the log itself is being parsed as a number, not the variable. So for example, when I add "toString()" as seen in the query below, it works for me.
My variable looked like:
As seen here, when I have both versions selected, when I use "toString()" on the appversion it correctly filters:
When I don't use the "toString()" function on appversion as seen below the iOS version filtering doesn't work:
Understandably this is with simulated data and not the real logs but hopefully this is all it is!