15 Mar 2023 11:41 PM - last edited on 24 Mar 2023 09:39 AM by Michal_Gebacki
If you're like me, you're probably brand new to the DQL world and are quickly trying to learn everything you can when it comes to DQL queries.
I recently had a client request a query to pull 2 specific fields out of a log and display them with on the log table within Dynatrace's new Logs and Events (Powered by Grail) tab. After some time, I got a solution that worked exactly how they wanted, and figured others might want the information I discovered.
Here's the setup:
Here's the DQL query I used:
fetch logs
| filter contains(content, "Order modify unsuccessful") and dt.process.name == "tomcat"
| parse content, "DATA 'Order modify unsuccessful' SPACE STRING:ITN"
| parse content, "DATA 'clientIpAddress' LD ':' DQS:client_ip"
| fields timestamp, content, ITN, client_ip
And here's what the output table looks like:
The key points to note on this query:
That's it! I've posted a mock log file below this as well if folks want to give it a try on their own time:
2023/03/15 16:05:48.279 [ERROR] http-ono-8080-heyo-117 (com.test.are.we.OrderES) -> {"testTransactionID":"123-456-789-10101-F90000000009","clientIpAddress":"192.168.12.122"},
ErrorException: [2405] Order modify unsuccessful (AB23JK)
at com.website.are.bll.order.OrderBLLImpl.modifyOrder(OrderTESTImpl.java:1111)
at com.website.are.ws.OrderWS.modifyOrder(OrderWS.java:222)
at java.lang.reflect.Method.invoke(Method.java:333)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:444)
Hope this is helpful to anyone just starting out with DQL queries!
12 May 2023 08:39 PM
Thank you for these tips and tricks @chris_smerek