question

JasonKronickCA-1429 avatar image
0 Votes"
JasonKronickCA-1429 asked AndrewBlumhardt-1137 answered

Azure Monitor Logs Time Range

I am using the Azure Monitor Logs API connection to query logs from a Logic App and want to set a custom time range for the query.
194826-image.png

I have looked for documentation on how to format the time range input string but have not been able to figure it out. Does anyone have any insight?

Thank you!

azure-monitor
image.png (5.0 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Monalla-MSFT avatar image
0 Votes"
Monalla-MSFT answered Monalla-MSFT commented

Hello @JasonKronickCA-1429 - Welcome to Microsoft Q&A and thanks for reaching out.

You can set the time range in the query itself if you want to use any other values from the predefined value in the Time Range. The Time Range value will be changed to "Set in query"

194879-image.png

Hope this helps. and please feel free to reach out if you have any further questions.



If the above response was helpful, please feel free to "Accept as Answer" and "Upvote" the same so it can be beneficial to the community.



image.png (70.7 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks so much for the answer. I had tried doing that earlier but due to the complexities of the queries there wasn't a way to add that where clause. I tried adding it to the end of the queries but some had some complex joins and would fail due to a syntax error when I added it to the end. It seems like providing a custom time range is the only option unless there is a way to add a where clause to the end of the query without it ever causing an error. Any thoughts?

0 Votes 0 ·
Monalla-MSFT avatar image Monalla-MSFT JasonKronickCA-1429 ·

@JasonKronickCA-1429 - That is correct Jason. Providing custom range is the only option.

Hope that helps.

If the above response was helpful, please feel free to "Accept as Answer" and "Upvote" the same so it can be beneficial to the community.

0 Votes 0 ·
AndrewBlumhardt-1137 avatar image
0 Votes"
AndrewBlumhardt-1137 answered JasonKronickCA-1429 commented

Strange. It is supposed to revert to "Set in query" or a drop down menu with the option for a custom value. Pulling the query in as a variable may be the issue. Have you considered adding the query directly? Just paste it in the field provided.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

It does revert to "Set in query" but the issue is, I can't add the "where TimeGenerated between ..." clause to the query because it doesn't look like, syntactically, you can just add a where clause to the end of any query.

Unfortunately, I can't edit the queries myself from the source so I have to bring them in as a variable. I can append to it in the field but again appending to the end seems to cause some issues.

0 Votes 0 ·
AndrewBlumhardt-1137 avatar image
0 Votes"
AndrewBlumhardt-1137 answered

If you print out the time value it has a specific format. I assume if you used an expression that produces the same date-time format or even hard code a value in another variable that might work.

Expression: formatDateTime(utcNow(), 'M/d/yyyy, hh:mm:ss:fff tt')

198255-2022-05-02-13-29-40.jpg



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.