09 Jan 2024 10:27 AM - edited 09 Jan 2024 02:10 PM
Hello Community,
I've some questions about BizEvents and issues I'm encountering.
This is my first time working on BizEvents, so the answers may be simple.
I would like to retrieve the “Request-Body” information from an action.
To keep it simple, I started by collecting the entire body (it works well):
I run my DQL command, and we see that I have recovered the entire body:
One of the problems I encounter is when there are multiple values for the same variables in the body.
I don't know how to process it to retrieve all "nR" and "nC" values.
I would like a BizEvent record by “CorrelationId”.
When I try to parse the BizEvent, I only get the first row.
Question #1: How to obtain a row by CorrelationId?
Sometimes the variables do not appear in the same order in the body. So I get “null” in this case.
Question n°2: How do I obtain the values of my variables whatever the order in which they appear?
Then I tried not to capture the entire body but only the fields that interest me. (e.g. “nC”) :
Only, I have nothing going back to this field.
Question #3: Do you know how I could configure each of these fields for it to work?
Solved! Go to Solution.
09 Jan 2024 02:16 PM
Is your response body a json? If so, you can use the path to point the exactly field you need, let's say the field you need is the correlationID, then you need to tell the path to look for it, but in your case you will need to provide also a position, since it seems to be a list, so it should be something like 0.correlationID, this should get you the value from first row.
The problem here is when you don't know how many positions you will get in the result... you will end up like me here: https://community.dynatrace.com/t5/DQL/is-it-possible-to-search-and-parse-an-specific-Json-List/td-p...
09 Jan 2024 02:39 PM
Thanks for this.
I think it's actually .json.
Indeed, the number of positions may vary. However, unlike you, I cannot have empty positions.
I'll look into that to see what I can do.
10 Jan 2024 01:37 PM
Does anyone have an idea for question #3?
18 Jan 2024 02:48 PM
Maybe take a look at this, it could help :
18 Jan 2024 03:13 PM - edited 18 Jan 2024 04:56 PM
Thanks @Pierre_L
For Q#1 & Q#2, it's resolved with :
fetch bizevents
| fieldsAdd Ximestamp = timestamp
| filter isNotNull(responsebodyfull)
| parse responsebodyfull, "JSON(strict=false):json"
| expand jobs=json[jobs]
| parse jobs, """LD '"correlationId":' STRING:correlationId LD '"montantE":' INTEGER:montantE LD '"nR":' INTEGER:nR LD '"nC":' INTEGER:nC LD '"XX":' STRING:XX LD '"formule":' STRING:formule"""
| fields XTimestamp, correlationId, nR, nC, XX, montantE
| limit 10000
18 Jan 2024 03:19 PM
For Question #3, I made progress with this config :
But I still have a problem.
This allows me to only recover the variable at the indicated position (here 0).
How do I make this able to retrieve all existing positions?