|
| 1 | +--- |
| 2 | +id: azure-container-instances |
| 3 | +title: Azure Container Instances |
| 4 | +description: Learn about the Sumo Logic collection process for the Azure Container Instances service. |
| 5 | +--- |
| 6 | + |
| 7 | +import useBaseUrl from '@docusaurus/useBaseUrl'; |
| 8 | + |
| 9 | +<img src={useBaseUrl('img/integrations/microsoft-azure/azure-container-instances.png')} alt="Thumbnail icon" width="50"/> |
| 10 | + |
| 11 | +[Azure Container Instances](https://learn.microsoft.com/en-us/azure/container-instances/) is a fully managed serverless container service that enables you to deploy and manage containers in Azure without the need for virtual machines. It is ideal for event-driven applications, microservices, and batch processing workloads. |
| 12 | + |
| 13 | +## Log and metric types |
| 14 | + |
| 15 | +For Azure Container Instances, you can collect the following logs and metrics: |
| 16 | + |
| 17 | +* **Audit Logs**. The activity log contains subscription-level events that track operations for each Azure resource as seen from outside that resource. For more details, refer to the [Azure Documentation](https://learn.microsoft.com/en-us/azure/container-instances/monitor-azure-container-instances#azure-activity-log). |
| 18 | +* **Resource Logs**. Capture container creation, execution, and failure logs. Refer to the [Microsoft Documentation](https://learn.microsoft.com/en-us/azure/container-instances/container-instances-monitor#resource-logs) to know about the schema for resource logs. |
| 19 | +* **Metrics**. Metrics for Azure Container Instances are in the following namespaces: |
| 20 | + * [Microsoft.ContainerInstance/containerGroups](https://learn.microsoft.com/en-us/azure/azure-monitor/reference/supported-metrics/microsoft-containerinstance-containergroups-metrics) |
| 21 | + |
| 22 | +For more information on supported dimensions, refer to [Azure documentation](https://learn.microsoft.com/en-us/azure/container-instances/container-instances-monitor#metrics). |
| 23 | + |
| 24 | +## Setup |
| 25 | + |
| 26 | +Azure service sends monitoring data to Azure Monitor, which can then [stream data to an event hub](https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/stream-monitoring-data-event-hubs). Sumo Logic supports: |
| 27 | + |
| 28 | +* Logs collection from [Azure Monitor](https://docs.microsoft.com/en-us/azure/monitoring-and-diagnostics/monitoring-get-started) using our [Azure Event Hubs source](/docs/send-data/collect-from-other-data-sources/azure-monitoring/ms-azure-event-hubs-source/). |
| 29 | +* Metrics collection using our [HTTP Logs and Metrics source](/docs/send-data/collect-from-other-data-sources/azure-monitoring/collect-metrics-azure-monitor/) via Azure Functions deployed using the ARM template. |
| 30 | + |
| 31 | +You must explicitly enable diagnostic settings for each domain, namespaces, custom topic, and system topic you want to monitor. You can forward logs to the same event hub provided they satisfy the limitations and permissions as described [here](https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/diagnostic-settings?tabs=portal#destination-limitations). |
| 32 | + |
| 33 | +When you configure the event hubs source or HTTP source, plan your source category to ease the querying process. A hierarchical approach allows you to make use of wildcards. For example: `Azure/AzureContainerInstances/Logs`, `Azure/AzureContainerInstances/Metrics`. |
| 34 | + |
| 35 | +### Configure field in field schema |
| 36 | + |
| 37 | +1. [**Classic UI**](/docs/get-started/sumo-logic-ui-classic). In the main Sumo Logic menu, select **Manage Data > Logs > Fields**. <br/>[**New UI**](/docs/get-started/sumo-logic-ui). In the top menu select **Configuration**, and then under **Logs** select **Fields**. You can also click the **Go To...** menu at the top of the screen and select **Fields**. |
| 38 | +1. Search for the following fields: |
| 39 | + - `tenant_name`. This field is tagged at the collector level. You can get the tenant name using the instructions [here](https://learn.microsoft.com/en-us/azure/active-directory-b2c/tenant-management-read-tenant-name#get-your-tenant-name). |
| 40 | + - `location`. The region to which the resource name belongs to. |
| 41 | + - `subscription_id`. ID associated with a subscription where the resource is present. |
| 42 | + - `resource_group`. The resource group name where the Azure resource is present. |
| 43 | + - `provider_name`. Azure resource provider name (for example, Microsoft.Network). |
| 44 | + - `resource_type`. Azure resource type (for example, storage accounts). |
| 45 | + - `resource_name`. The name of the resource (for example, storage account name). |
| 46 | + - `service_type`. Type of the service that can be accessed with a Azure resource. |
| 47 | + - `service_name`. Services that can be accessed with an Azure resource (for example, in Azure Container Instances service is Subscriptions). |
| 48 | +1. Create the fields if they are not present. Refer to [Manage fields](/docs/manage/fields/#manage-fields). |
| 49 | + |
| 50 | +### Configure field extraction rules |
| 51 | + |
| 52 | +Create the following Field Extraction Rule(s) (FER) for Azure Storage by following the instructions in [Create a Field Extraction Rule](/docs/manage/field-extractions/create-field-extraction-rule/). |
| 53 | + |
| 54 | +#### Azure location extraction FER |
| 55 | + |
| 56 | + ```sql |
| 57 | + Rule Name: AzureLocationExtractionFER |
| 58 | + Applied at: Ingest Time |
| 59 | + Scope (Specific Data): tenant_name=* |
| 60 | + ``` |
| 61 | + |
| 62 | + ```sql title="Parse Expression" |
| 63 | + json "location", "properties.resourceLocation", "properties.region" as location, resourceLocation, service_region nodrop |
| 64 | + | replace(toLowerCase(resourceLocation), " ", "") as resourceLocation |
| 65 | + | if (!isBlank(resourceLocation), resourceLocation, location) as location |
| 66 | + | if (!isBlank(service_region), service_region, location) as location |
| 67 | + | if (isBlank(location), "global", location) as location |
| 68 | + | fields location |
| 69 | + ``` |
| 70 | + |
| 71 | +#### Resource ID extraction FER |
| 72 | + |
| 73 | + ```sql |
| 74 | + Rule Name: AzureResourceIdExtractionFER |
| 75 | + Applied at: Ingest Time |
| 76 | + Scope (Specific Data): tenant_name=* |
| 77 | + ``` |
| 78 | + |
| 79 | + ```sql title="Parse Expression" |
| 80 | + json "resourceId", "ResourceId" as resourceId1, resourceId2 nodrop |
| 81 | + | if (isBlank(resourceId1), resourceId2, resourceId1) as resourceId |
| 82 | + | toUpperCase(resourceId) as resourceId |
| 83 | + | parse regex field=resourceId "/SUBSCRIPTIONS/(?<subscription_id>[^/]+)" nodrop |
| 84 | + | parse field=resourceId "/RESOURCEGROUPS/*/" as resource_group nodrop |
| 85 | + | parse regex field=resourceId "/PROVIDERS/(?<provider_name>[^/]+)" nodrop |
| 86 | + | parse regex field=resourceId "/PROVIDERS/[^/]+(?:/LOCATIONS/[^/]+)?/(?<resource_type>[^/]+)/(?<resource_name>.+)" nodrop |
| 87 | + | parse regex field=resource_name "(?<parent_resource_name>[^/]+)(?:/PROVIDERS/[^/]+)?/(?<service_type>[^/]+)/?(?<service_name>.+)" nodrop |
| 88 | + | if (isBlank(parent_resource_name), resource_name, parent_resource_name) as resource_name |
| 89 | + | fields subscription_id, location, provider_name, resource_group, resource_type, resource_name, service_type, service_name |
| 90 | + ``` |
| 91 | + |
| 92 | +### Configure metric rules |
| 93 | + |
| 94 | +Create the following metrics rules by following the instructions in [Create a metrics rule](/docs/metrics/metric-rules-editor/#create-a-metrics-rule). |
| 95 | + |
| 96 | +#### Azure observability metadata extraction container instance level |
| 97 | + |
| 98 | + ```sql |
| 99 | + Rule Name: AzureObservabilityMetadataExtractionAzureContainerInstanceLevel |
| 100 | + ``` |
| 101 | + |
| 102 | + ```sql title="Metric match expression" |
| 103 | + resourceId=resourceId=/SUBSCRIPTIONS/*/RESOURCEGROUPS/*/PROVIDERS/MICROSOFT.CONTAINERINSTANCE/*/* tenant_name=* |
| 104 | + ``` |
| 105 | + | Fields extracted | Metric rule | |
| 106 | + |:------------------|:----------------------------| |
| 107 | + | subscription_id | $resourceId._1 | |
| 108 | + | resource_group | $resourceId._2 | |
| 109 | + | provider_name | MICROSOFT.CONTAINERINSTANCE | |
| 110 | + | resource_type | $resourceId._3 | |
| 111 | + | resource_name | $resourceId._4 | |
| 112 | +
|
| 113 | +### Configure metrics collection |
| 114 | + |
| 115 | +For metrics collection follow guidelines in [Azue Metrics Source](/docs/send-data/hosted-collectors/microsoft-source/azure-metrics-source/). |
| 116 | + |
| 117 | +While you configure metrics collection you need to tag the location field in the source with right location value. <br/><img src={useBaseUrl('img/integrations/microsoft-azure/Azure-Storage-Tag-Location.png')} alt="Azure Container Instance Tag Location" style={{border: '1px solid gray'}} width="400" /> |
| 118 | + |
| 119 | +Also you need to configure namespaces as shown below. <br/><img src={useBaseUrl('img/integrations/microsoft-azure/azure-container-instance-namespaces.png')} alt="Azure Container Instance Namespaces" style={{border: '1px solid gray'}} width="500" /> |
| 120 | +
|
| 121 | +### Configure logs collection |
| 122 | +
|
| 123 | +1. Add a hosted collector and [HTTP Source](/docs/send-data/collect-from-other-data-sources/azure-monitoring/collect-metrics-azure-monitor/#step-1-configure-an-http-source). |
| 124 | +2. Create and push a custom image using a <a href="https://sumologic-app-data-v2.s3.amazonaws.com/dashboards/Azure-Container-Instances/Dockerfile" target="_blank">Docker file</a> and <a href="https://sumologic-app-data-v2.s3.amazonaws.com/dashboards/Azure-Container-Instances/output_conf.yaml" target="_blank">output_conf.yaml</a> onto a Docker hub. |
| 125 | +3. Use existing resource group or create a new one in Azure. |
| 126 | +4. Update the <a href="https://sumologic-app-data-v2.s3.amazonaws.com/dashboards/Azure-Container-Instances/logging-sidecar-deploy.yaml" target="_blank">**logging-sidecar-deploy.yaml**</a> file with your own application image whose logs you want to collect. In the file we have used nginx application as an example whose log files(access logs and error logs) are created in a shared volume(/var/log/nginx). |
| 127 | +4. Deploy the <a href="/files/logging-sidecar-deploy.yaml" target="_blank">**logging-sidecar-deploy.yaml**</a> Azure template. |
| 128 | + * parameter - `/fluent-bit/bin/fluent-bit` is fluent-bit executable path. |
| 129 | + * parameter - `-c /root/output_conf.yaml` is fluent-bit configuration file path. |
| 130 | + * Inputs parameters in the `output_conf.yaml` file. |
| 131 | + * **tail**. Read logs command name. |
| 132 | + * **path**. Log file path from where fluent bit collector is collecting logs. |
| 133 | + * Outputs parameters in the `output_conf.yaml` file. |
| 134 | + * **name*. HTTP output collector. By default, the name key will be assigned with *http* as value. |
| 135 | + * **format**. Data format by which you can send logs to Sumo Logic. By default, the format key will be assigned with *json_lines* as value. |
| 136 | + * **compress**. Payload compression mechanism. The recommended file type from Sumo Logic is `gzip`. |
| 137 | + * **match**. Log matching rule. |
| 138 | + * **host**. Sumo Logic collector host. |
| 139 | + * **port**. Sumo Logic collector port. |
| 140 | + * **tls=on**. By default, *on* value will be assigned to enable the TLS support. |
| 141 | + * **tls.verify**. By default, *off* value will be assigned to disable the certificate validation. |
| 142 | + * **URI**. Sumo Logic HTTP collector URI. |
| 143 | + * **json_date_key**. Name of the date field in output. |
| 144 | + * **header**. X-Sumo-Fields header used to tag fields during logs collection. |
| 145 | +
|
| 146 | +To learn more details on how to deploy azure container instance, refer to the [Azure Documentation](https://learn.microsoft.com/en-us/azure/container-instances/container-instances-quickstart). |
| 147 | +
|
| 148 | +#### Activity Logs |
| 149 | +
|
| 150 | +To collect activity logs, follow the instructions [here](/docs/integrations/microsoft-azure/audit). Skip this step if you are already collecting activity logs for a subscription. |
| 151 | +
|
| 152 | +:::note |
| 153 | +Since this source contains logs from multiple regions, make sure that you do not tag this source with the location tag. |
| 154 | +::: |
| 155 | +
|
| 156 | +## Viewing the Azure Container Instances dashboards |
| 157 | +
|
| 158 | +import ViewDashboards from '../../reuse/apps/view-dashboards.md'; |
| 159 | +
|
| 160 | +<ViewDashboards/> |
| 161 | +
|
| 162 | +### Error Logs |
| 163 | +
|
| 164 | +The **Azure Container Instance - Error Logs** dashboard provides detailed information on the container activity. This dashboard also provides comprehensive overview of Total Errors, Top 10 Errors bar chart, Log Level Error distribution, Error Trend by Container, and Recent Container Logs. |
| 165 | +
|
| 166 | +<img src={useBaseUrl('https://sumologic-app-data-v2.s3.amazonaws.com/dashboards/Azure-Container-Instances/Azure-Container-Instance-Error-Logs.png')} alt="Azure Container Instance - Error Logs" style={{border: '1px solid gray'}} width="800" /> |
| 167 | +
|
| 168 | +### Administrative Operations |
| 169 | +
|
| 170 | +The **Azure Container Instances - Administrative Operations** dashboard provides details on the operational activities and status of your Azure Container Instances resources. |
| 171 | +
|
| 172 | +Use this dashboard to: |
| 173 | +* Monitor the distribution of operation types and their success rates to ensure proper functioning of your Container Instances system. |
| 174 | +* Identify potential issues by analyzing the top operations causing errors and correlating them with specific users or applications. |
| 175 | +* Track recent write and delete operations to maintain an audit trail of changes made to your Azure Container Instances configuration. |
| 176 | +
|
| 177 | +<img src={useBaseUrl('https://sumologic-app-data-v2.s3.amazonaws.com/dashboards/Azure-Container-Instances/Azure-Container-Instances-Administrative-Operations.png')} alt="Azure Container Instances - Administrative Operations" style={{border: '1px solid gray'}} width="800" /> |
| 178 | +
|
| 179 | +### Resources |
| 180 | +
|
| 181 | +The **Azure Container Instances - Resources** dashboard shows average memory usage, avg CPU usage, and average network bytes received and transmitted per sec. |
| 182 | +
|
| 183 | +Use this dashboard to: |
| 184 | +* Monitor Average Memory and CPU usage with it's trend. |
| 185 | +* Monitor Average Received and Transmitted network bytes. |
| 186 | +
|
| 187 | +<img src={useBaseUrl('https://sumologic-app-data-v2.s3.amazonaws.com/dashboards/Azure-Container-Instances/Azure-Container-Instances-Resources.png')} alt="Azure Container Instances - Errors" style={{border: '1px solid gray'}} width="800" /> |
| 188 | +
|
| 189 | +### Policy and Recommendations |
| 190 | +
|
| 191 | +The **Azure Container Instances - Policy and Recommendations** dashboard provides details on policy events and recommendations for your Azure Container Instances resources. |
| 192 | +
|
| 193 | +Use this dashboard to: |
| 194 | +* Monitor the success and failure rates of policy events to ensure proper configuration and compliance. |
| 195 | +* Track and analyze recent recommendations to improve the performance and security of your Azure Container Instances setup. |
| 196 | +* Identify trends in policy events and recommendations over time to proactively address potential issues. |
| 197 | +
|
| 198 | +<img src={useBaseUrl('https://sumologic-app-data-v2.s3.amazonaws.com/dashboards/Azure-Container-Instances/Azure-Container-Instances-Policy-and-Recommendations.png')} alt="Azure Container Instances - Policy and Recommendations" style={{border: '1px solid gray'}} width="800" /> |
| 199 | +
|
| 200 | +## Troubleshooting |
| 201 | +
|
| 202 | +### HTTP Logs and Metrics Source used by Azure Functions |
| 203 | +
|
| 204 | +To troubleshoot metrics collection, follow the instructions in [Troubleshooting metrics collection](/docs/send-data/collect-from-other-data-sources/azure-monitoring/collect-metrics-azure-monitor/#troubleshooting-metrics-collection) in *Collect Metrics from Azure Monitor*. |
0 commit comments