NLog.config update required after upgrade of AppSpider Enterprise | AppSpider Documentation
There was an issue with the System Event Logs not appearing in the AppSpider Enterprise UI from release 3.8.227, which required a change in the NLog.config file.
The fix has been addressed in Appspider Enterprise 3.8.231 and a fresh install of this release includes the change.
However, with upgrades of Appspider Enterprise, the NLog.config file is not overwritten as the customer may have customized the settings, so a manual change is required.
Manually configure the NLog file
-
Navigate to where AppSpider Enterprise is installed. For example, C:\Program Files (x86)\Rapid 7\AppSpider Enterprise 3.8\IIS.NET
-
Open the NLog.config file in an editor and add the following line above the
<targets>
element:
<variable name="connectionString" value="Server" />
- Add the following target to the
<targets>
element:
<target name="database"
xsi:type="Database"
dbProvider="System.Data.SqlClient"
connectionString="${var:connectionString}"
commandText="
INSERT INTO [DATABASE_NAME].[dbo].[Log] (Date, Thread, Level, Logger, Message, Exception, UserId, ClientId, Url)
VALUES (@Date, @Thread, @Level, @Logger, @Message, @Exception, NULLIF(@UserId, 'None'), NULLIF(@ClientId, 'None'), @Url) ">
<parameter name="@Date" layout="${date}" dbType="DateTime" />
<parameter name="@Thread" layout="${threadname:whenEmpty=${threadid}}" />
<parameter name="@Level" layout="${level:uppercase=true}" />
<parameter name="@Logger" layout="${logger}" />
<parameter name="@Message" layout="${message}" />
<parameter name="Exception" layout="${exception:format=tostring,stacktrace:innerFormat=tostring:innerException}" />
<parameter name="@UserId" layout="${event-properties:item=user}" />
<parameter name="@ClientId" layout="${event-properties:item=client}" />
<parameter name="@Url" layout="${aspnet-request-url}" />
</target>
-
Insert the name of the database which AppSpider Enterprise connects to, in the commandText attribute, replacing the ‘DATABASE_NAME’ text. Example: INSERT INTO [DATABASE_NAME] ⇒ INSERT INTO [ASE]
-
Update the
<rules>
element of the NLog.config file, to add the database to the writeTo attribute in the relevant logger level. Example:<logger name="*" levels="Fatal,Error" writeTo="file, eventlog, database" />
-
To apply this change, restart IIS.