Logging incoming request referrer in azure











up vote
0
down vote

favorite












I have deployed few .net APIs and applications as app service to Azure which is being used internally and also some of them can be called externally. Also have set up an Azure Alert for one of the major app services (let's call it Service A) which sends email notification in case of 404 error.



Looking into AppInsights, I can see some requests that result in 404 error when calling one the services without any endpoint included in the url (service B https://serviceB.mydomain.com/) and of course Service B returns 404 however AppInsights doesn't display the request caller (request referer). To investigate the 404 error I need to know about the caller url.



I'm aware that programmatically I can read request referer but how it can be done for 404 error which caused by a request to an endpoint which doesn't exist moreover some requests may not have referer. How can I log the caller url [preferably in Azure app services/appInsights]?










share|improve this question




























    up vote
    0
    down vote

    favorite












    I have deployed few .net APIs and applications as app service to Azure which is being used internally and also some of them can be called externally. Also have set up an Azure Alert for one of the major app services (let's call it Service A) which sends email notification in case of 404 error.



    Looking into AppInsights, I can see some requests that result in 404 error when calling one the services without any endpoint included in the url (service B https://serviceB.mydomain.com/) and of course Service B returns 404 however AppInsights doesn't display the request caller (request referer). To investigate the 404 error I need to know about the caller url.



    I'm aware that programmatically I can read request referer but how it can be done for 404 error which caused by a request to an endpoint which doesn't exist moreover some requests may not have referer. How can I log the caller url [preferably in Azure app services/appInsights]?










    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have deployed few .net APIs and applications as app service to Azure which is being used internally and also some of them can be called externally. Also have set up an Azure Alert for one of the major app services (let's call it Service A) which sends email notification in case of 404 error.



      Looking into AppInsights, I can see some requests that result in 404 error when calling one the services without any endpoint included in the url (service B https://serviceB.mydomain.com/) and of course Service B returns 404 however AppInsights doesn't display the request caller (request referer). To investigate the 404 error I need to know about the caller url.



      I'm aware that programmatically I can read request referer but how it can be done for 404 error which caused by a request to an endpoint which doesn't exist moreover some requests may not have referer. How can I log the caller url [preferably in Azure app services/appInsights]?










      share|improve this question















      I have deployed few .net APIs and applications as app service to Azure which is being used internally and also some of them can be called externally. Also have set up an Azure Alert for one of the major app services (let's call it Service A) which sends email notification in case of 404 error.



      Looking into AppInsights, I can see some requests that result in 404 error when calling one the services without any endpoint included in the url (service B https://serviceB.mydomain.com/) and of course Service B returns 404 however AppInsights doesn't display the request caller (request referer). To investigate the 404 error I need to know about the caller url.



      I'm aware that programmatically I can read request referer but how it can be done for 404 error which caused by a request to an endpoint which doesn't exist moreover some requests may not have referer. How can I log the caller url [preferably in Azure app services/appInsights]?







      azure httprequest alert azure-application-insights http-referer






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 16 at 3:39

























      asked Nov 16 at 3:33









      Amir Chatrbahr

      1,2861219




      1,2861219
























          2 Answers
          2






          active

          oldest

          votes

















          up vote
          1
          down vote













          So far I was not able to find any facility in Azure portal to configure the AppInsights however it can be configured programmatically to track the referer and of course if the request doesn't have referer in the header for some reason, it can not be captured.



          This link explains how AppInsight configuration can be done in codes to track the Referer.



          UPDATE - And the root of issue:



          Turned out "ALWAYS ON" feature in Azure Application Settings was ON for the Service B which means it sends request to the base url to keep it active and avoid recycling. For more info about Always On you can refer to here



          enter image description here






          share|improve this answer






























            up vote
            0
            down vote













            One of the main reason for this would be that you might configure the availability test in App Insights



            To be particularly this will be a URL ping test





            This will hit the configured URL frequently at the location you configured






            share|improve this answer





















            • Thanks @Jayendran for the hint. I checked all the existing AppInsights but it wasn't the case. Also the request is not on a regular time intervals. More likely one of the internal/external services is pinging the url but can't track it.
              – Amir Chatrbahr
              Nov 18 at 22:32













            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53331031%2flogging-incoming-request-referrer-in-azure%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote













            So far I was not able to find any facility in Azure portal to configure the AppInsights however it can be configured programmatically to track the referer and of course if the request doesn't have referer in the header for some reason, it can not be captured.



            This link explains how AppInsight configuration can be done in codes to track the Referer.



            UPDATE - And the root of issue:



            Turned out "ALWAYS ON" feature in Azure Application Settings was ON for the Service B which means it sends request to the base url to keep it active and avoid recycling. For more info about Always On you can refer to here



            enter image description here






            share|improve this answer



























              up vote
              1
              down vote













              So far I was not able to find any facility in Azure portal to configure the AppInsights however it can be configured programmatically to track the referer and of course if the request doesn't have referer in the header for some reason, it can not be captured.



              This link explains how AppInsight configuration can be done in codes to track the Referer.



              UPDATE - And the root of issue:



              Turned out "ALWAYS ON" feature in Azure Application Settings was ON for the Service B which means it sends request to the base url to keep it active and avoid recycling. For more info about Always On you can refer to here



              enter image description here






              share|improve this answer

























                up vote
                1
                down vote










                up vote
                1
                down vote









                So far I was not able to find any facility in Azure portal to configure the AppInsights however it can be configured programmatically to track the referer and of course if the request doesn't have referer in the header for some reason, it can not be captured.



                This link explains how AppInsight configuration can be done in codes to track the Referer.



                UPDATE - And the root of issue:



                Turned out "ALWAYS ON" feature in Azure Application Settings was ON for the Service B which means it sends request to the base url to keep it active and avoid recycling. For more info about Always On you can refer to here



                enter image description here






                share|improve this answer














                So far I was not able to find any facility in Azure portal to configure the AppInsights however it can be configured programmatically to track the referer and of course if the request doesn't have referer in the header for some reason, it can not be captured.



                This link explains how AppInsight configuration can be done in codes to track the Referer.



                UPDATE - And the root of issue:



                Turned out "ALWAYS ON" feature in Azure Application Settings was ON for the Service B which means it sends request to the base url to keep it active and avoid recycling. For more info about Always On you can refer to here



                enter image description here







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 22 at 1:22

























                answered Nov 20 at 0:56









                Amir Chatrbahr

                1,2861219




                1,2861219
























                    up vote
                    0
                    down vote













                    One of the main reason for this would be that you might configure the availability test in App Insights



                    To be particularly this will be a URL ping test





                    This will hit the configured URL frequently at the location you configured






                    share|improve this answer





















                    • Thanks @Jayendran for the hint. I checked all the existing AppInsights but it wasn't the case. Also the request is not on a regular time intervals. More likely one of the internal/external services is pinging the url but can't track it.
                      – Amir Chatrbahr
                      Nov 18 at 22:32

















                    up vote
                    0
                    down vote













                    One of the main reason for this would be that you might configure the availability test in App Insights



                    To be particularly this will be a URL ping test





                    This will hit the configured URL frequently at the location you configured






                    share|improve this answer





















                    • Thanks @Jayendran for the hint. I checked all the existing AppInsights but it wasn't the case. Also the request is not on a regular time intervals. More likely one of the internal/external services is pinging the url but can't track it.
                      – Amir Chatrbahr
                      Nov 18 at 22:32















                    up vote
                    0
                    down vote










                    up vote
                    0
                    down vote









                    One of the main reason for this would be that you might configure the availability test in App Insights



                    To be particularly this will be a URL ping test





                    This will hit the configured URL frequently at the location you configured






                    share|improve this answer












                    One of the main reason for this would be that you might configure the availability test in App Insights



                    To be particularly this will be a URL ping test





                    This will hit the configured URL frequently at the location you configured







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 18 at 15:59









                    Jayendran

                    2,88331334




                    2,88331334












                    • Thanks @Jayendran for the hint. I checked all the existing AppInsights but it wasn't the case. Also the request is not on a regular time intervals. More likely one of the internal/external services is pinging the url but can't track it.
                      – Amir Chatrbahr
                      Nov 18 at 22:32




















                    • Thanks @Jayendran for the hint. I checked all the existing AppInsights but it wasn't the case. Also the request is not on a regular time intervals. More likely one of the internal/external services is pinging the url but can't track it.
                      – Amir Chatrbahr
                      Nov 18 at 22:32


















                    Thanks @Jayendran for the hint. I checked all the existing AppInsights but it wasn't the case. Also the request is not on a regular time intervals. More likely one of the internal/external services is pinging the url but can't track it.
                    – Amir Chatrbahr
                    Nov 18 at 22:32






                    Thanks @Jayendran for the hint. I checked all the existing AppInsights but it wasn't the case. Also the request is not on a regular time intervals. More likely one of the internal/external services is pinging the url but can't track it.
                    – Amir Chatrbahr
                    Nov 18 at 22:32




















                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53331031%2flogging-incoming-request-referrer-in-azure%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Trompette piccolo

                    How do I get these specific pathlines to nodes?

                    What visual should I use to simply compare current year value vs last year in Power BI desktop