Hello,
We are facing a problem parsing log lines where we understand that the root cause is due to the data being multiline.
Below is an example log:
2023-02-31 11:51:28,988 - INFO - Prediction Output: class0_proba=0.00 class1_proba=0.00
INFO: 0.0.0.0:12345 - “POST /api/v1/model/string/predict HTTP/1.1” 200 OK
We would like to parse the Status Code information but it is not being effective:
fetch logs
| filter contains(content, “POST”)
| parse content, “LD 'HTTP/1.1\”’ LD:httpcode "
In a log that is not multiline this parse works correctly. Does anyone have any idea how we can extract this information?
Hi @MarcioKaue
The reason why is because LD is only matching one single line. You have to use the DATA matcher, which is the multiline matcher.
| parse content, """DATA 'HTTP/1.1\" ' INT:httpcode"""
Best,
Sini
Thanks @sinisa_zubic , it worked perfectly!
@sinisa_zubic ,Can we also get other fields using DATA?
Example get status code and API name “/api/v1/model/string/predict”
yes you can
| parse content, """DATA '"' ALPHA:method ' ' LD:apiName ' HTTP/1.1\" ' INT:httpcode"""
If you are new to the Dynatrace Pattern Language, I would suggest that you check out those two resources
I am trying to figure out DQL/DPL
Stuck on this:
info: cartservice.cartstore.ValkeyCartStore[0]
AddItemAsync called with userId=744108ea-1a14-11f0-b19d-fe219cfda8e5, productId=2ZYFJ3GM2N, quantity=5
Need to pull UserID, productId, and quantity.
Going through a class on university:
But their example didn’t have two lines. I know to use DATA but just can’t figure out.