Request URI Not Parsed in AGWFirewallLogs Query

iuiu 20 Reputation points
2025-02-25T04:03:54.7566667+00:00

When using a WAF, I tried to check the request URI before applying an exception because there were many detected logs. When querying AGWFirewallLogs, I extended the query using extend parseUrl = parse_url(RequestUri), but parseUrl appears empty. How can I check the request URL in this case?

Azure Web Application Firewall
{count} votes

Accepted answer
  1. Sai Prasanna Sinde 4,335 Reputation points Microsoft External Staff
    2025-02-25T08:05:39.9133333+00:00

    Hi @Anonymous

    Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.

    To check the Request URI, please go through the below points:

    • Make sure that the RequestURI field itself contains valid URL data. If the RequestURI field is empty or contains malformed URLs, parseUrl will naturally return an empty result.
    • You can use the below query to check the contents of RequestURI:
        AGWFirewallLogs
        | project TimeGenerated, RequestUri
        | limit 10
      
    • Even if the RequestURI field contains data, examine the format of the URLs. parseUrl expects a properly formatted URL, including the scheme (like http:// or https://). If the URLs are missing the scheme or have other formatting issues, parseUrl might not be able to parse them correctly.
    • Additionally, ensure that URL strings embedded as parameters within other URL strings are properly encoded. Failure to encode these embedded URLs can lead to parsing errors.

    If the RequestURI field appears correct, you can try alternative methods to extract the desired information. Use KQL string functions like substring, split, and indexOf to extract specific parts of the URL.

    • For example, to extract the path from the RequestUri, you could use a query as below:
        AGWFirewallLogs
        | extend path = substring(RequestUri, indexOf(RequestUri, '/'), strlen(RequestUri))
        | project TimeGenerated, RequestUri, path
      
    • To extract the domain from the URL, you can use a combination of split and indexOf:
        AGWFirewallLogs
        | extend parts = split(RequestUri, '/')
        | extend domain = parts[1] // Assume the domain is the third element after splitting by '/'
        | project TimeGenerated, RequestUri, domain
      
    • It's essential to verify the diagnostic settings of your Application Gateway to ensure that the logging level is set to capture detailed information, including complete request URLs. The logging level determines the granularity of information captured in the logs, and an insufficient logging level might result in missing URL data. Please refer the document.

    Kindly let us know if the above helps or you need further assistance on this issue.

    Your feedback is important so please take a moment to Accept answers.

    If you still have questions, please let us know what is needed in the comments so the question can be answered.

    Thank you for helping to improve Microsoft Q&A!

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.