Skip to content

Log settings

Ryan Newington edited this page Jun 24, 2018 · 1 revision

The Lithnet LAPS web app is configured to log audit events to the Windows event log, and trace information to a log file. These settings are controlled by the nlog element of the web.config file in the root of the application directory.

Note that in order to log events to the event log, the following command must be run from an PowerShell session with administrative rights.

New-EventLog -Logname Application -Source LAPSWeb

Log files will be created in the /app_data/logs/ folder, and rotated every day for a maximum of 7 days. You can modify the <target name="laps-file"> element to adjust these parameters.

Sample web.config <nlog> section

<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <targets>
    <target name="laps-eventlog" xsi:type="EventLog" source="LAPSWeb" log="Application" layout="${message}${newline}${exception:format=ToString}" eventId="${event-properties:EventID:whenEmpty=1}" />
    <target name="laps-file" xsi:type="File" fileName="app_data/logs/lapsweb.log" archiveEvery="Day" archiveNumbering="Date" maxArchiveFiles="7" concurrentWrites="true" layout="${longdate}|${level:uppercase=true:padding=5}|${message}${exception:format=ToString}" />
  </targets>
  <rules>
    <logger minlevel="Info" writeTo="laps-eventlog" name="*" />
    <logger minlevel="Trace" writeTo="laps-file" name="*" />
  </rules>
</nlog>

Event log entries

The app uses specific event IDs for each message, which are documented in the Event log entries list