bin/XEtemplates/Log File IO Detail Tracking.xml

<event_sessions xmlns="http://schemas.microsoft.com/sqlserver/2008/07/extendedeventconfig">
  <event_session name="Log File IO Detail Tracking" maxMemory="4" eventRetentionMode="allowSingleEventLoss" trackCausality="false" dispatchLatency="30" maxEventSize="0" memoryPartitionMode="none">
    <templateCategory>
      <!-- _locID_text="templateCategory" _locComment = "" -->System Monitoring</templateCategory>
    <templateName>
      <!-- _locID_text = "templateName" _locComment = "" -->Log File IO Detail Tracking</templateName>
    <templateDescription>
      <!-- _locID_text = "templateDescription" _locComment = "" -->Monitors the IO for database log files on a server by tracking asynchronous IO, database log flushes, file writes, spinlock backoffs of type LOGFLUSHQ and waits of type WRITELOG. This template collects data in two ways: raw data is collected to a ring buffer and spinlock backoff information is aggregated based on the input buffer (sql_text). The session is filtered for a single log file per database; if you have multiple log files you can modify the filter for the file_write_completed and file_written events to include more than just file_id = 2.</templateDescription>
    <event package="sqlos" name="async_io_completed" />
    <event package="sqlos" name="async_io_requested" />
    <event package="sqlos" name="spinlock_backoff">
      <action package="sqlserver" name="sql_text" />
      <predicate>
        <leaf>
          <comparator name="equal_uint64" package="package0"></comparator>
          <event name="spinlock_backoff" package="sqlos" field="type"></event>
          <value>85</value>
        </leaf>
      </predicate>
    </event>
    <event package="sqlos" name="wait_info">
      <action package="sqlserver" name="client_app_name" />
      <action package="sqlserver" name="is_system" />
      <action package="sqlserver" name="session_id" />
      <predicate>
        <and>
          <leaf>
            <comparator name="equal_uint64" package="package0"></comparator>
            <event name="wait_info" package="sqlos" field="opcode"></event>
            <value>1</value>
          </leaf>
          <leaf>
            <comparator name="equal_uint64" package="package0"></comparator>
            <event name="wait_info" package="sqlos" field="wait_type"></event>
            <value>182</value>
          </leaf>
        </and>
      </predicate>
    </event>
    <event package="sqlserver" name="databases_log_flush" />
    <event package="sqlserver" name="file_write_completed">
      <parameter name="collect_path" value="1" />
      <predicate>
        <leaf>
          <comparator name="equal_uint64" package="package0"></comparator>
          <event name="file_write_completed" package="sqlserver" field="file_id"></event>
          <value>2</value>
        </leaf>
      </predicate>
    </event>
    <event package="sqlserver" name="file_written">
      <parameter name="collect_path" value="1" />
      <predicate>
        <leaf>
          <comparator name="equal_uint64" package="package0"></comparator>
          <event name="file_written" package="sqlserver" field="file_id"></event>
          <value>2</value>
        </leaf>
      </predicate>
    </event>
    <target package="package0" name="histogram">
      <parameter name="filtering_event_name" value="sqlos.spinlock_backoff" />
      <parameter name="source" value="sqlserver.sql_text" />
    </target>
    <target package="package0" name="ring_buffer" />
  </event_session>
</event_sessions>