> ## Documentation Index
> Fetch the complete documentation index at: https://docs.maia.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Maia runner logs

export const maia = "Maia";

export const m_runner = "Maia runner";

export const RunnerMetadata = ({runnerType, platforms = []}) => {
  return <div style={{
    background: 'var(--colors-background-light, #f9fafb)',
    border: '1px solid var(--colors-border-default, #e5e7eb)',
    borderRadius: '12px',
    padding: '20px 28px',
    marginBottom: '28px'
  }}>
      <table style={{
    width: '100%',
    borderCollapse: 'collapse'
  }}>
        <tbody>
          <tr>
            <td style={{
    fontWeight: '600',
    paddingRight: '32px',
    paddingBottom: '14px',
    whiteSpace: 'nowrap',
    verticalAlign: 'middle',
    width: '180px'
  }}>Runner type</td>
            <td style={{
    paddingBottom: '14px',
    verticalAlign: 'middle'
  }}>{runnerType}</td>
          </tr>
          <tr>
            <td style={{
    fontWeight: '600',
    paddingRight: '32px',
    whiteSpace: 'nowrap',
    verticalAlign: 'middle'
  }}>Runner platform</td>
            <td style={{
    verticalAlign: 'middle'
  }}>
              <div style={{
    display: 'flex',
    flexWrap: 'wrap',
    gap: '8px'
  }}>
                {platforms.map((platform, i) => <span key={i} style={{
    background: '#dcfce7',
    color: '#15803d',
    border: '1px solid #bbf7d0',
    borderRadius: '9999px',
    padding: '3px 12px',
    fontSize: '0.85rem',
    fontWeight: '500',
    whiteSpace: 'nowrap'
  }}>
                    {platform} ✅
                  </span>)}
              </div>
            </td>
          </tr>
        </tbody>
      </table>
    </div>;
};

<RunnerMetadata runnerType={`${maia} Hybrid`} platforms={["AWS", "Azure", "Snowflake", "Matillion"]} />

The activity of your {m_runner} can be logged in your cloud provider's logging service, either [AWS CloudWatch](#aws-cloudwatch) or [Azure Log Analytics](#azure-log-analytics), to help you address any issues you encounter. Analyzing the logs generated by your {m_runner} helps you to identify patterns, troubleshoot issues, and gain insights into the behavior of your deployment.

***

## AWS CloudWatch

You can retrieve, inspect, and analyze log data using AWS CloudWatch in the AWS console.

By default, logs are kept for an indefinite time, but you can set up a retention period based on your requirements.

### Prerequisites

* You must have a valid AWS account to access and use AWS CloudWatch.
* Your {m_runner} must be deployed in the instance for which you want to generate logs. The {m_runner} captures and forwards log data to AWS CloudWatch for monitoring and analysis.
* Your AWS account must have the necessary IAM (Identity and Access Management) permissions to access CloudWatch and retrieve logs. At a minimum, the account should have the `cloudwatch:DescribeLogGroups` and `cloudwatch:FilterLogEvents` permissions for the specific log group and log streams you want to access.
* Configure a log group in CloudWatch to store the logs generated by the {m_runner}.
* Configure the log retention settings for the log group to ensure that logs are retained for the desired period.

### How to view logs in AWS

To retrieve logs from AWS CloudWatch for a deployed {m_runner} in an instance, follow these steps.

1. In the [AWS Management Console](https://aws.amazon.com/console/), navigate to the **CloudWatch** service from the services menu or from the search bar at the top of the console screen.

2. In the **CloudWatch** dashboard, locate and click **Log Groups** in the left-hand navigation menu under the **Logs** category.

3. In the **Log Groups** page, search for the log group associated with your {m_runner}'s logs. The log group should have a name or pattern specific to your deployment, which you will have set when you installed the {m_runner}.

   <Note>
     If a log group for the {m_runner} does not already exist, create a new log group by following the process in [Log groups](/docs/guides/aws-fargate-manual-runner-setup#log-groups-optional).
   </Note>

4. Click on the log group to access its details. You will see a list of log streams within that group.

5. Identify the log stream that corresponds to the specific instance where your {m_runner} is deployed. Click on the log stream to view its logs.

6. Within the log stream, you can locate specific logs by applying filters, searching for keywords, or adjusting the time range.

***

## Azure Log Analytics

In the Azure console, you can retrieve, inspect, and analyze log data using the Azure Log Analytics service. Azure Log Analytics provides a centralized location for log storage, analysis, and visualization, enabling you to monitor and troubleshoot your Azure environment effectively.

Azure Log Analytics also allows you to create custom dashboards and set up alerts based on log data. These features can help you monitor and receive notifications for specific events or log conditions.

### Prerequisites

* You must have a valid Azure subscription to access and use Azure Log Analytics.
* You must have Azure Container Apps (ACA) or an Azure Kubernetes Service (AKS) cluster where the {m_runner} is deployed in a container. The container must be running and generating logs.
* Ensure that an Azure Log Analytics workspace has been created. This should have been created when you [installed the {m_runner}](/docs/guides/azure-arm-runner-install).
* You must [enable container monitoring](https://learn.microsoft.com/en-us/azure/azure-monitor/vm/vminsights-enable-portal) for the ACA or AKS cluster where the {m_runner} is deployed. This ensures that the logs generated by the container are collected and forwarded to Azure Log Analytics.

### How to view logs in Azure

To retrieve logs from Azure Log Analytics for a deployed {m_runner} in an instance, follow these steps.

1. In the [Azure Portal](https://portal.azure.com), navigate to the **Log Analytics** service from the services menu or from the search bar at the top of the portal screen.
2. In the **Log Analytics** dashboard, search for the workspace associated with your {m_runner}'s logs. The workspace should have a name or pattern specific to your deployment. Click the workspace name to enter that workspace.
3. In the Log Analytics workspace, click **Activity Log**. By default, you will see the **Logs** section where you can run queries and view log data.
4. In the **Logs** section, you can [write and execute queries](https://learn.microsoft.com/en-us/azure/azure-monitor/logs/get-started-queries) using the **Azure Monitor Query Language (KQL)** to retrieve specific logs. You can filter logs based on time range, specific instance, or other relevant parameters. See the example below.

The following tables can be queried for {m_runner} log data:

* `ContainerAppSystemLogs_CL`: Contains system-level logs generated by the container app platform, such as infrastructure events, health checks, and platform diagnostics. Use this table to investigate issues related to the container app environment or platform.
* `ContainerAppConsoleLogs_CL`: Contains console output (stdout and stderr) from your containerized application. Use this table to view application-level logs, debug output, or messages written by your app code.

### Query example

```kql theme={null}
// Retrieve logs with specific table
  ContainerAppSystemLogs_CL
  | project TimeGenerated, Message
```

Where `TimeGenerated` and `Message` are fields from the `ContainerAppSystemLogs_CL` table.

This query will retrieve the `timestamp` (TimeGenerated) and the `log message` (Message) from the system logs generated by container apps.
