# Problems getting filebeats to work with API keys

**URL:** <https://discuss.elastic.co/t/problems-getting-filebeats-to-work-with-api-keys/314982>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [September 23, 2022, 12:43am UTC](https://discuss.elastic.co/t/problems-getting-filebeats-to-work-with-api-keys/314982 "2022-09-23T00:43:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Russell\_Fulton](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/russell_fulton/32/62888_2.png) [@Russell\_Fulton](https://discuss.elastic.co/u/Russell_Fulton)\
**Post date:** [September 23, 2022, 12:43am UTC](https://discuss.elastic.co/t/problems-getting-filebeats-to-work-with-api-keys/314982/1 "2022-09-23T00:43:02Z")

</div>

I have just got filebeats (7.17.1) working on a bunch of ubuntu systems. I initially tried to use API keys for authentication but got errors from filebeat `"API key: invalid ApiKey value"` when it connects to the ES server. I swapped to using username and password and that worked fine.

The API keys were setup :

```auto
{
  "superuser": {
    "cluster": [
      "all"
    ],
    "indices": [
      {
        "names": [
          "*"
        ],
        "privileges": [
          "all"
        ],
        "allow_restricted_indices": true
      }
    ],
    "run_as": [
      "beat_ingest"
    ]
  }
}

```

where `beat_ingest` is the user that works when not using API key.

I am trying using the run as because I was hoping to be able to change privs without generating and distributing a new key.

Have I misunderstood how this is supposed to work?

---

<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 21, 2022, 2:43am UTC](https://discuss.elastic.co/t/problems-getting-filebeats-to-work-with-api-keys/314982/2 "2022-10-21T02:43:13Z")

</div>

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