admin管理员组

文章数量:1415637

I have 5 Container Apps (CAs) that belong to the same Container App Environment.

Is there a way to prevent a specific CA from emitting logs to my Log Analytics?
Currently, Azure does not support multi-line logs so when that CA raises an error I get about 20 lines for a single error (due to the traceback being shown in different lines). Meaning my costs are x20 for those logs.

The logs are emitted by the Container App console and used by an Application Insights.


CAE diagnostic setting doesn't have an option to disable specific CA logs either.

I have 5 Container Apps (CAs) that belong to the same Container App Environment.

Is there a way to prevent a specific CA from emitting logs to my Log Analytics?
Currently, Azure does not support multi-line logs so when that CA raises an error I get about 20 lines for a single error (due to the traceback being shown in different lines). Meaning my costs are x20 for those logs.

The logs are emitted by the Container App console and used by an Application Insights.


CAE diagnostic setting doesn't have an option to disable specific CA logs either.

Share Improve this question edited Feb 5 at 14:43 PythonForEver asked Feb 4 at 18:10 PythonForEverPythonForEver 4961 gold badge5 silver badges18 bronze badges 13
  • are these logs emitted by the apps or the underlying system? like apps often use app insights so you could disable app insights logging. really depends on which logs you re talking about – Thomas Commented Feb 5 at 1:15
  • Have you tried using DCR to filter logs? – Jahnavi Commented Feb 5 at 6:08
  • 1 @PythonForEver, all good. Ideally your app emits the log directly to app insights and you can configure at the app level log filtering. Then you could disable Container App console logs. – Thomas Commented Feb 5 at 19:35
  • 1 @PythonForEver Is it resolved then or I can provide an answer in a detailed way for clarity and also would be helpful to community. – Jahnavi Commented Feb 13 at 4:58
  • 1 @Jahnavi yes please, that would be very useful for other users. My implementation is a bit primitive (for now) – PythonForEver Commented Feb 18 at 9:16
 |  Show 8 more comments

1 Answer 1

Reset to default 1

To filter container logs from specific containers, you can use configmap approach as detailed here in the MSDoc.

In general, there are two data collection configuration methods to collect logs in container insights. One is with DCR, and the other one is config map.

Using ConfigMap, you can configure the collection of stderr and stdout logs separately for the cluster, so you can choose to enable one and not the other.

Firstly, you can get a config map yaml file template and add the necessary configuration changes according to your requirement.

In order to exlclude namespace, you can add the container details under exclude_namespaces stdout in the yaml file as shown below.

[log_collection_settings]  
[log_collection_settings.stdout]  enabled  =  true  
exclude_namespaces  =  [....]

Refer MSDoc for the available configuration methods and also detailed steps of data collection using config map.

You can also create a config map with kubectl commands and proceed further as shown below.

本文标签: Filter out logs from specific Azure Container AppStack Overflow