Logging incoming request referrer in azure










0















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




























    0















    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


























      0












      0








      0








      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 '18 at 3:39







      Amir Chatrbahr

















      asked Nov 16 '18 at 3:33









      Amir ChatrbahrAmir Chatrbahr

      1,4061323




      1,4061323






















          2 Answers
          2






          active

          oldest

          votes


















          1














          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
































            0














            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 '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',
            autoActivateHeartbeat: false,
            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









            1














            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





























              1














              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



























                1












                1








                1







                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 '18 at 1:22

























                answered Nov 20 '18 at 0:56









                Amir ChatrbahrAmir Chatrbahr

                1,4061323




                1,4061323























                    0














                    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 '18 at 22:32
















                    0














                    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 '18 at 22:32














                    0












                    0








                    0







                    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 '18 at 15:59









                    JayendranJayendran

                    3,48331541




                    3,48331541












                    • 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 '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 '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 '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 '18 at 22:32


















                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    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

                    Top Tejano songwriter Luis Silva dead of heart attack at 64

                    政党

                    天津地下鉄3号線