|
| 1 | +--- |
| 2 | +title: Syslog collection with Container Insights |
| 3 | +description: This article describes how to collect Syslog from AKS nodes using Container insights. |
| 4 | +ms.topic: conceptual |
| 5 | +ms.date: 01/31/2023 |
| 6 | +ms.reviewer: damendo |
| 7 | +--- |
| 8 | + |
| 9 | +# Syslog collection with Container Insights (preview) |
| 10 | + |
| 11 | +Container Insights offers the ability to collect Syslog events from Linux nodes in your [Azure Kubernetes Service (AKS)](../../aks/intro-kubernetes.md) clusters. Customers can use Syslog for monitoring security and health events, typically by ingesting syslog into SIEM systems like [Microsoft Sentinel](https://azure.microsoft.com/products/microsoft-sentinel/#overview). |
| 12 | + |
| 13 | +## Prerequisites |
| 14 | + |
| 15 | +- You will need to have managed identity authentication enabled on your cluster. To enable, see [migrate your AKS cluster to managed identity authentication](container-insights-enable-existing-clusters.md?tabs=azure-cli#migrate-to-managed-identity-authentication). Note: This which will create a Data Collection Rule (DCR) named `MSCI-<WorkspaceRegion>-<ClusterName>` |
| 16 | +- Minimum versions of Azure components |
| 17 | + - **Azure CLI**: Minimum version required for Azure CLI is [2.44.1 (link to release notes)](/cli/azure/release-notes-azure-cli#january-11-2023). See [How to update the Azure CLI](/cli/azure/update-azure-cli) for upgrade instructions. |
| 18 | + - **Azure CLI AKS-Preview Extension**: Minimum version required for AKS-Preview Azure CLI extension is [ 0.5.125 (link to release notes)](https://github.com/Azure/azure-cli-extensions/blob/main/src/aks-preview/HISTORY.rst#05125). See [How to update extensions](/cli/azure/azure-cli-extensions-overview#how-to-update-extensions) for upgrade guidance. |
| 19 | + - **Linux image version**: Minimum version for AKS node linux image is 2022.11.01. See [Upgrade Azure Kubernetes Service (AKS) node images](https://learn.microsoft.com/azure/aks/node-image-upgrade) for upgrade help. |
| 20 | + |
| 21 | +## How to enable Syslog |
| 22 | + |
| 23 | +Use the following command in Azure CLI to enable syslog collection when you create a new AKS cluster. |
| 24 | + |
| 25 | +```azurecli |
| 26 | +az aks create -g syslog-rg -n new-cluster --enable-managed-identity --node-count 1 --enable-addons monitoring --enable-msi-auth-for-monitoring --enable-syslog --generate-ssh-key |
| 27 | +``` |
| 28 | + |
| 29 | +Use the following command in Azure CLI to enable syslog collection on an existing AKS cluster. |
| 30 | + |
| 31 | +```azurecli |
| 32 | +az aks enable-addons -a monitoring --enable-msi-auth-for-monitoring --enable-syslog -g syslog-rg -n existing-cluster` |
| 33 | +``` |
| 34 | + |
| 35 | + |
| 36 | +## How to access Syslog data |
| 37 | + |
| 38 | +Syslog data is stored in the [Syslog](/azure/azure-monitor/reference/tables/syslog) table in your Log Analytics workspace. You can create your own [log queries](../logs/log-query-overview.md) in [Log Analytics](../logs/log-analytics-overview.md) to analyze this data or use any of the [prebuilt queries](../logs/log-query-overview.md). |
| 39 | + |
| 40 | +:::image type="content" source="media/container-insights-syslog/azmon-3.png" lightbox="media/container-insights-syslog/azmon-3.png" alt-text="Screenshot of Syslog query loaded in the query editor in the Azure Monitor Portal UI." border="false"::: |
| 41 | + |
| 42 | +You can open Log Analytics from the **Logs** menu in the **Monitor** menu to access Syslog data for all clusters or from the AKs cluster's menu to access Syslog data for only that cluster. |
| 43 | + |
| 44 | +:::image type="content" source="media/container-insights-syslog/aks-4.png" lightbox="media/container-insights-syslog/aks-4.png" alt-text="Screenshot of Query editor with Syslog query." border="false"::: |
| 45 | + |
| 46 | +### Sample queries |
| 47 | + |
| 48 | +The following table provides different examples of log queries that retrieve Syslog records. |
| 49 | + |
| 50 | +| Query | Description | |
| 51 | +|:--- |:--- | |
| 52 | +| `Syslog` |All Syslogs | |
| 53 | +| `Syslog | where SeverityLevel == "error"` |All Syslog records with severity of error | |
| 54 | +| `Syslog | summarize AggregatedValue = count() by Computer` |Count of Syslog records by computer | |
| 55 | +| `Syslog | summarize AggregatedValue = count() by Facility` |Count of Syslog records by facility | |
| 56 | + |
| 57 | +## Editing your Syslog collection settings |
| 58 | + |
| 59 | +To modify the configuration for your Syslog collection, you modify the [data collection rule (DCR)](../essentials/data-collection-rule-overview.md) that was created when you enabled it. |
| 60 | + |
| 61 | +Select **Data Collection Rules** from the **Monitor** menu in the Azure portal. |
| 62 | + |
| 63 | +:::image type="content" source="media/container-insights-syslog/dcr-1.png" lightbox="media/container-insights-syslog/dcr-1.png" alt-text="Screenshot of Data Collection Rules tab in the Azure Monitor portal UI." border="false"::: |
| 64 | + |
| 65 | +Select your DCR and then **View data sources**. Select the **Linux Syslog** data source to view the Syslog collection details. |
| 66 | +>[!NOTE] |
| 67 | +> A DCR is created automatically when you enable syslog. The DCR follows the naming convention `MSCI-<WorkspaceRegion>-<ClusterName>`. |
| 68 | +
|
| 69 | +:::image type="content" source="media/container-insights-syslog/dcr-3.png" lightbox="media/container-insights-syslog/dcr-3.png" alt-text="Screenshot of Data Sources tab for Syslog data collection rule." border="false"::: |
| 70 | + |
| 71 | +Select the minimum log level for each facility that you want to collect. |
| 72 | + |
| 73 | +:::image type="content" source="media/container-insights-syslog/dcr-4.png" lightbox="media/container-insights-syslog/dcr-4.png" alt-text="Screenshot of Configuration panel for Syslog data collection rule." border="false"::: |
| 74 | + |
| 75 | + |
| 76 | +## Known limitations |
| 77 | + |
| 78 | +- **Onboarding**. Syslog collection can only be enabled from command line during public preview. |
| 79 | +- **Container restart data loss**. Agent Container restarts can lead to syslog data loss during public preview. |
| 80 | + |
| 81 | +## Next steps |
| 82 | + |
| 83 | +- Read more about [Syslog record properties](/azure/azure-monitor/reference/tables/syslog) |
| 84 | + |
| 85 | + |
0 commit comments