18 Jun 2024 11:35 AM - last edited on 19 Jun 2024 08:33 AM by MaciejNeumann
Hello,
I am creating a new dashboard that has some text variables that I use in other query grail tiles to filter logs and spans.
However, if I don't set a value in those variables I get the error everytime I open the dashboard:
"Define a value in the referenced variables: user_id"
I don't want to impose that the text variable is filled. If I then enter a space and delete it in the text variable, the dashboard then works and the error disappears.
Here is a screenshot of the error:
The query I have for Conversation App logs is:
fetch logs
| filter service.name == "conversation"
| filter contains(user_id, $user_id)
| filter contains(content, $interaction_id )
| filter contains(content, $search_in_logs )
| sort timestamp asc
| fields timestamp, content, extra_fields, user_id, pid
Is there a way to fix this?
Thanks
18 Jun 2024 12:06 PM - edited 18 Jun 2024 12:07 PM
Hello!
I have very limited experience but looking over your problem I do have a suggestion you can try.
I think the problem might be in your filter lines.
You have:
| filter contains(user_id, $user_id)
I suggest trying:
| if ($user_id != "", filter contains(user_id, $user_id))
The idea is checking if $user_id is not empty. If there's something in there, it applies the contain filter. If not, it skips the filter entirely. The dashboard shouldn't complain then.
If it works, do the same for $interaction_id and $search_in_logs
Let me know if it works!
18 Jun 2024 12:12 PM
Unfortunately, that doesn't work, it gives an error with the query, but thanks for the suggestion, it would make sense to work
18 Jun 2024 12:15 PM - edited 18 Jun 2024 12:16 PM
Can you show me the updated query you did (with my suggestion) and the error it gave?
Sometimes, progress is just finding a different error xP Or is it the same error?
08 Aug 2024 04:17 AM
My query has similar requirements
timeseries value=avg(cloud.aws.lambda.duration),
by: { dt.entity.custom_device }
| lookup [fetch dt.entity.custom_device ],
lookupField:id,
sourceField:dt.entity.custom_device,
fields:{
entity.name,
managementZones,
customProperties,
tags
}
| filter
if($Suites != "", in(tags, $Suites))
I still end up getting the error Define a value in the referenced variables: $Suites". This is if there is nothing selected in the dropdown. If i select at least 1 value in the dropdown, the query works.