0

I have an ASP.NET Core API. I'm using the standard .NET Core logging Microsoft.Extensions.Logging.ILogger

I am seeing log entries that I'm not logging. Some log entries show the JSON payload that is coming into the API which is nice but I'm not logging it anywhere in my code.

The one that is really bugging me is something that seems to be hitting one of my controllers constantly even though no one is calling it and it's not even a valid endpoint it's just the base controller.

[INF] Request starting HTTP/1.1 GET http://***.***.***.***/api/webhook (ca22a1cb)

[INF] Request finished in 0.1028ms 404 (791a596a)

"webhook" is a controller but the request doesn't seem to be on any specific endpoint on the controller. It seems to be replicating the above 2 log statements. It's the same block as above (request starting and request finished) and always 4 times a minute (8 total). They also always appear at the same time during the minute. One set at 15 seconds into the minue, one set 3 seconds later at 18 seconds into the minute, one set at 45 seconds into the minute and a last one another 3 seconds later at 48 seconds into the minute.

James
  • 523
  • 1
  • 4
  • 20
  • Do you see this behavior both when working locally and when the application is deployed? – Ofiris Feb 06 '19 at 05:31
  • have you tried debugging to find which statement triggers this? Or maybe use fiddler to capture HTTP referrer? – kowsikbabu Feb 06 '19 at 05:39
  • @Ofiris unfortunately I deleted my local log files but I do think I saw it in local log files as well. It's definitely when it's deployed (on AWS) but other than me only 2 or 3 people are even aware the API exists (all inside the company I work for). – James Feb 06 '19 at 20:57

1 Answers1

0

While working with a co-worker we figured it out. It's hosted on AWS and AWS was configured to do a Health Check every 30 seconds to the /api/webhook endpoint (not even a valid endpoint) since it failed it was trying again 3 seconds later. Changing the Health Check interval and changing the endpoint caused the logging to change.

I must have been mistaken that it was showing in local logs.

I still don't know why these kind of logs are being created by the ASP.NET Core project in the first place since my code doesn't have any log entries for that but at least now I know where the request is coming from.

James
  • 523
  • 1
  • 4
  • 20
  • 1
    The framework logs some stuff by default. You can [turn it off](https://stackoverflow.com/questions/35251078/how-to-turn-off-the-logging-done-by-the-asp-net-core-framework) if you want. – mason Feb 06 '19 at 21:45