Logging in Sitecore Managed Cloud containers

Current version: 10.2

Sitecore Managed Cloud containers use an ELK stack to collect and aggregate the log files that are output by the various containers in a Kubernetes cluster. The following diagram illustrates the data flow for a Windows based, Sitecore role container:

Customize the logging of Sitecore roles

You can customize the logging for a Sitecore role in a Managed Cloud container. To customize the logging for a Sitecore role, you modify the Stdout of the container by editing the configuration file of the Log Monitor. The configuration file for the Log Monitor is stored in C:\LogMonitor\logmonitorconfig.json in each container image.

Note

Increasing the number of log files generated by your AKS cluster can cause storage issues in the Elasticsearch database. This can lead to the loss of some logged data. The retention period for Elasticsearch data is set to 30 days by default.

The base configuration that collects both Sitecore logs, and IIS logs is:

RequestResponse
{
    "LogConfig": {
        "sources": [
            {
                "type": "File",
                "directory": "c:\\inetpub\\logs",
                "filter": "*.log",
                "includeSubdirectories": true
            },
            {
                "type": "File",
                "directory": "c:\\inetpub\\wwwroot\\App_data\\logs",
                "filter": "log.*.txt",
                "includeSubdirectories": false
            }
        ]
    }
}

To update the logmonitorconfig.json file, create a new config file and build it into a custom image.

Common LogMonitor custom configurations

Output all Sitecore logs:

RequestResponse
{
    "LogConfig": {
        "sources": [
            {
                "type": "File",
                "directory": "c:\\inetpub\\logs",
                "filter": "*.log",
                "includeSubdirectories": true
            },
            {
                "type": "File",
                "directory": "c:\\inetpub\\wwwroot\\App_data\\logs",
                "filter": "*.txt",
                "includeSubdirectories": false
            }
        ]
    }
}

Output Windows events and system logs:

RequestResponse
{
    "LogConfig": {
        "sources": [
            {
                "type": "EventLog",
                "startAtOldestRecord": true,
                "eventFormatMultiLine": false,
                "channels": [
                    {
                         "name": "system",
                         "level": "Information"
                    },
                    {
                         "name": "application",
                         "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
            }
        ]
    }
}

Do you have some feedback for us?

If you have suggestions for improving this article,