0

I would like to filter out some messages from being logged in xConnect - for example 'Failed to locate activity...'.

I have tried this configuration but it does not seem to take effect:

<Settings>
  <Serilog>
    <Using>
      <FileSinkAssembly>Serilog.Sinks.File</FileSinkAssembly>
      <RollingFileSinkAssembly>Serilog.Sinks.RollingFile</RollingFileSinkAssembly>
    </Using>
    <MinimumLevel>
      <Default>Error</Default>
    </MinimumLevel>
    <WriteTo>
      <FileSink>
        <Name>RollingFile</Name>
        <Args>
          <pathFormat>App_Data\\Logs\\xconnect-log-${MachineName}-${InstanceName}-{Date}.txt</pathFormat>
          <retainedFileCountLimit>7</retainedFileCountLimit>
          <buffered>False</buffered>
        </Args>
      </FileSink>
    </WriteTo>
    <Filter>
      <Args>
        <Name>ByExcluding</Name>
        <expression>StartsWith(@Message, 'Failed to locate activity')</expression>
      </Args>
    </Filter>
    <Properties>
      <Application>XConnect</Application>
    </Properties>
  </Serilog>
</Settings>

1 Answer 1

2

I contacted Sitecore support and they gave me a zip file - they noted that this is not an officially tested method and do not guarantee it will work without causing any issues.

Looking at the zip file it contains:

  1. Example xml config on how to configure:
<Settings>
  <Serilog>
    <Using>
      <FileSinkAssembly>Serilog.Sinks.File</FileSinkAssembly>
      <RollingFileSinkAssembly>Serilog.Sinks.RollingFile</RollingFileSinkAssembly>
      <SerilogFiltersExpressionsAssembly>Serilog.Filters.Expressions</SerilogFiltersExpressionsAssembly>
    </Using>
    <MinimumLevel>
      <Default>Information</Default>
    </MinimumLevel>
    <WriteTo>
      <FileSink>
        <Name>RollingFile</Name>
        <Args>
          <pathFormat>App_Data\\Logs\\xconnect-log-${MachineName}-${InstanceName}-{Date}.txt</pathFormat>
          <retainedFileCountLimit>7</retainedFileCountLimit>
          <buffered>False</buffered>
        </Args>
      </FileSink>
    </WriteTo>
    <Filter>
        <Filter1>
            <Name>ByExcluding</Name>
            <Args>
                <expression>(@Message like '%Failed to locate activity%' or @MessageTemplate like '%Sitecore.XConnect.Operations.SetFacetOperation%') and (@MessageTemplate not like '%Sitecore.XConnect.Operations.PatchFacetOperation%') and (@Exception like '%KeyBehaviorCache%'or @Exception like '%InteractionsCache%' or @Exception like '%ExmKeyBehaviorCache%' or @Exception like '%EngagementMeasures%' or @Exception like '%ContactBehaviorProfile%' or @Message like '%KeyBehaviorCache%'or @Message like '%InteractionsCache%' or @Message like '%ExmKeyBehaviorCache%' or @Message like '%EngagementMeasures%' or @Message like '%ContactBehaviorProfile%')</expression>
            </Args>
        </Filter1>
    </Filter>
    <Properties>
      <Application>XConnect</Application>
    </Properties>
  </Serilog>
</Settings>
  1. Looks like the Serilog.Filters.Expressions.dll dll from here and its dependency Superpower.dll.

So you can try those dll's, or you might want to contact sitecore support for them to provide the dll's for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.