1

We are in the process of upgrading to Sitecore 10.1 and we are also changing our infrastructure to use AKS.

I just noticed the the Sitecore logs we get from the pods seems to only include the logs sent through the LogFileAppender (in other words, we only see the logs from the log.{date}.{time}.txt files).

We have some modules that are by default configured to log in their own files (for example Dianoga or Sitecron). When inspecting the pods, I can see their log files on disk, but the content of these files does not show in the pods logs (that we can get using the kubectl logs ${POD_NAME} command or using a tool like k9s).

By changing these modules configuration so that they use the LogFileAppender works. More precisely, this works

    <logger name="Sitecron" role:require="ContentManagement">
        <appender-ref ref="SitecronLogFileAppender">
            <patch:delete />
        </appender-ref>
        <appender-ref ref="LogFileAppender" />
    </logger>

but I was wondering if there is way of doing this at the pod level (or in a more Kubernetes native way). For example, if I could change the way Sitecore configures the pods to also include some other log files would be great.

I hope my question is clear enough! Thanks

1 Answer 1

1

The LogMonitor.exe application that is included in the Sitecore images and stored in the C:\LogMonitor folder is a Microsoft logging tool for Windows containers. This application is responsible to monitor configured log sources and to pipe a formatted output to SDTOUT output location.

The tool configuration is defined in the C:\LogMonitor\LogMonitorConfig.json file. This is the default configuration taken from the sitecore-xp0-cm:10.1.1 image:

{
    "LogConfig": {
      "sources": [
        {
          "type": "EventLog",
          "startAtOldestRecord": false,
          "eventFormatMultiLine": false,
          "channels": [
            {
              "name": "system",
              "level": "Error"
            }
          ]
        },
        {
          "type": "File",
          "directory": "c:\\inetpub\\logs",
          "filter": "*.log",
          "includeSubdirectories": true
        },
        {
          "type": "File",
          "directory": "c:\\inetpub\\wwwroot\\App_data\\logs",
          "filter": "log.*.txt",
          "includeSubdirectories": false
        }
      ]
    }
  }

You need to add your own source in this configuration or modify the filter of the third source in the default configuration (filter value is "log.*.txt"), currently including only .txt files with a filename that starts with log., in order to include additional logging files with a different name pattern.

1
  • Thanks! I brought a copy of this file in our source code, modified it and then copied it back during our custom Sitecore image creation process and it works. Found this link presenting the LogMonitor tool if anyone else is interested : techcommunity.microsoft.com/t5/containers/…
    – JF Hamel
    Oct 15, 2021 at 15:52

Your Answer

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

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