Set up logging of incoming HTTP requests for .NET Core and .NET 6
You can set up logging of incoming HTTP requests in Creatio .NET Core version 7.17.3-8.0.7 and Creatio .NET 6 version 8.0.8 and later.
Creatio lets you use the following logging types of incoming HTTP requests:
- standard logging
- extended logging
Standard logging of incoming HTTP requests
Standard logging lets you log incoming HTTP requests. The Request.log
file in the Logs
directory of the Creatio root directory stores standard logs.
To set up standard logging:
- Open the
appsettings.json
configuration file in the Creatio root directory. - Move to the
Standard
block. Standard logging is enabled by default (theEnabled
flag is set totrue
). - Add HTTP response codes into the
StatusCodes
flag. Creatio will log the requests that receive the specified response codes. If you turn on theEnabled
flag and leave theStatusCodes
flag empty, Creatio logs all incoming HTTP requests.
"RequestLogging": {
"Standard": {
"Enabled": true,
"StatusCodes": [ 200, 300, 302 ]
},
...
}
You can analyze the logs using the Log Parser Studio utility because the log format is similar to the IIS log format.
Extended logging for incoming HTTP requests
Extended logging lets you retrieve detailed information about logs for incoming HTTP requests. The ExtendedRequest.log
file in the Logs
directory of the Creatio root directory stores extended logs. Creatio saves data about the response body of an incoming HTTP request automatically when extended logging is turned on.
To set up extended logging:
-
Open the
appsettings.json
configuration file in the Creatio root directory. -
Move to the
Extended
block. Extended logging is turned off by default (theEnabled
flag is set tofalse
). -
Set the
Enabled
flag totrue
to turn on logging. -
If you want to retrieve information about the HTTP request body in the log, set the
LogRequestBody
flag totrue
(false
by default). -
Set the size of the displayed request/response body (the first N bytes) in the
MaxBodySizeBytes
flag.ImportantExtended logging affects performance if Creatio receives a large number of requests or you set a large value of the
MaxBodySizeBytes
flag. -
Add HTTP response codes into the
StatusCodes
flag. Creatio will log the requests that receive the specified response codes. If you turn on theEnabled
flag and leave theStatusCodes
flag empty, Creatio logs all incoming HTTP requests.
"RequestLogging": {
...,
"Extended": {
"Enabled": true,
"LogRequestBody": false,
"MaxBodySizeBytes": 500,
"StatusCodes": [ 400, 401, 403 ]
}
}
You can use standard and extended logging simultaneously with different values of the StatusCodes
flag. If the StatusCodes
flag values for standard and extended logging match, Creatio duplicates the logs for incoming HTTP requests in the Request.log
and ExtendedRequest.log
files with different details.