# Set default fleet managed agent log level

**URL:** <https://discuss.elastic.co/t/set-default-fleet-managed-agent-log-level/341361>\
**Category:** Elastic Cloud on Kubernetes (ECK)\
**Tags:** fleet\
**Created:** [August 22, 2023, 11:56am UTC](https://discuss.elastic.co/t/set-default-fleet-managed-agent-log-level/341361 "2023-08-22T11:56:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![etyekmot](https://avatars.discourse-cdn.com/v4/letter/e/919ad9/32.png) [@etyekmot](https://discuss.elastic.co/u/etyekmot)\
**Post date:** [August 22, 2023, 11:56am UTC](https://discuss.elastic.co/t/set-default-fleet-managed-agent-log-level/341361/1 "2023-08-22T11:56:25Z")

</div>

Hi all,

I'm running the stack via ECK. Does anyone know of a way to set the default log level of the agents?  
I want to change it from info to error

Thanks  
Tom

---

<div class="post-metadata">

**Author:** ![Julia\_Bardi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/julia_bardi/32/79463_2.png) [@Julia\_Bardi](https://discuss.elastic.co/u/Julia_Bardi)\
**Post date:** [August 22, 2023, 3:41pm UTC](https://discuss.elastic.co/t/set-default-fleet-managed-agent-log-level/341361/2 "2023-08-22T15:41:19Z")

</div>

You can change it in the `spec` section of [yaml](https://github.com/elastic/cloud-on-k8s/blob/main/config/recipes/elastic-agent/fleet-kubernetes-integration.yaml#L88) config:

```auto
config:
    agent:
      logging:
        level: error

```

---

<div class="post-metadata">

**Author:** ![etyekmot](https://avatars.discourse-cdn.com/v4/letter/e/919ad9/32.png) [@etyekmot](https://discuss.elastic.co/u/etyekmot)\
**Post date:** [August 23, 2023, 2:28pm UTC](https://discuss.elastic.co/t/set-default-fleet-managed-agent-log-level/341361/3 "2023-08-23T14:28:24Z")

</div>

This throws an error when running in fleet mode

```auto
"fleet-server" is invalid: spec.config: Invalid value: v1.Config{Data:map[string]interface {}{"agent":map[string]interface {}{"logging":map[string]interface {}{"level":"error"}}}}: remove config, it can't be set in fleet

```

---

<div class="post-metadata">

**Author:** ![Julia\_Bardi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/julia_bardi/32/79463_2.png) [@Julia\_Bardi](https://discuss.elastic.co/u/Julia_Bardi)\
**Post date:** [August 24, 2023, 7:10am UTC](https://discuss.elastic.co/t/set-default-fleet-managed-agent-log-level/341361/4 "2023-08-24T07:10:33Z")

</div>

Could you try it for the `elastic-agent` entry?

---

<div class="post-metadata">

**Author:** ![etyekmot](https://avatars.discourse-cdn.com/v4/letter/e/919ad9/32.png) [@etyekmot](https://discuss.elastic.co/u/etyekmot)\
**Post date:** [September 14, 2023, 9:55am UTC](https://discuss.elastic.co/t/set-default-fleet-managed-agent-log-level/341361/5 "2023-09-14T09:55:22Z")

</div>

Hi, sorry for the delay

The same error appears if it's on either fleet server or agent config

This is the full error:

```auto
Agent/elasticsearch/elastic-agent dry-run failed, reason: Forbidden: admission webhook "elastic-agent-validation-v1alpha1.k8s.elastic.co" denied the request: Agent.agent.k8s.elastic.co "elastic-agent" is invalid: spec.config: Invalid value: v1.Config{Data:map[string]interface {}{"agent":map[string]interface {}{"logging":map[string]interface {}{"level":"error"}}}}: remove config, it can't be set in fleet mode

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 12, 2023, 9:55am UTC](https://discuss.elastic.co/t/set-default-fleet-managed-agent-log-level/341361/6 "2023-10-12T09:55:25Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
