Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extend IIS logs in .Net Core 2.2 Api

I'm moving stuff from my ASP.Net MVC application (.Net Framework 4.7) to a new .Net Core 2.2 API.

In my old MVC application I added some specific POST properties to the IIS logs via HttpResponseBase.AppendToLog(). I can't find a similar method in .Net Core.

My question: how can I add properties that are in the HttpPost to the IIS logs in a .Net Core Api? This is how the logs look like:

2019-06-26 19:34:07 website-ip-address POST /some-endpoint [data-to-log-ended-here] 443 username ip-address etc.
like image 927
kloarubeek Avatar asked Nov 17 '22 06:11

kloarubeek


1 Answers

I don't have a direct answer to your question, but I found two posts that may relate to what you are asking

  • How to log http POST data to IIS log in asp.net core
  • Where do logs go when running ASP.NET Core on IIS 7.5?

Generally, in an Asp.net Core app it's more common to use its logging API to work with a powerful 3rd party logging libraries like Serilog to easily log to a number of different sources you can choose from. Though IIS is not one of them, I'd recommend take a look at Application Insights which is very popular for doing logging in Asp.net Core applications. Hope this helps somewhat!

like image 92
Ray Avatar answered Dec 21 '22 02:12

Ray