# Unable to use apm-server dynamic kafka topic with elastic-agent-standalone

**URL:** <https://discuss.elastic.co/t/unable-to-use-apm-server-dynamic-kafka-topic-with-elastic-agent-standalone/359826>\
**Category:** Elastic Agent\
**Created:** [May 20, 2024, 12:48pm UTC](https://discuss.elastic.co/t/unable-to-use-apm-server-dynamic-kafka-topic-with-elastic-agent-standalone/359826 "2024-05-20T12:48:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Garvit\_Jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/garvit_jain/32/134655_2.png) [@Garvit\_Jain](https://discuss.elastic.co/u/Garvit_Jain)\
**Post date:** [May 20, 2024, 12:48pm UTC](https://discuss.elastic.co/t/unable-to-use-apm-server-dynamic-kafka-topic-with-elastic-agent-standalone/359826/1 "2024-05-20T12:48:29Z")

</div>

Using following config with elastic agent standalone mode

```auto
      kafka-output:
        type: kafka
        hosts:
          - 'kafka:9092'
        client_id: kafka-output
        topic: '%{[data_stream.type]}-%{[data_stream.dataset]}-%{[data_stream.namespace]}'

```

and Getting error

```auto
{
  "log.level": "error",
  "@timestamp": "2024-05-20T12:45:50.189Z",
  "message": "runner returned with an error",
  "component": {
    "binary": "apm-server",
    "dataset": "elastic_agent.apm_server",
    "id": "kafka-output",
    "type": "apm"
  },
  "log": {
    "source": "kafka-output"
  },
  "error": {
    "message": "failed to create libbeat output pipeline: topic '%{[data_stream.type]}-%{[data_stream.dataset]}-%{[data_stream.namespace]}' is invalid, it must match '[a-zA-Z0-9._-]' accessing 'output.kafka'"
  },
  "ecs.version": "1.6.0",
  "log.origin": {
    "file.line": 190,
    "file.name": "beatcmd/reloader.go",
    "function": "github.com/elastic/apm-server/internal/beatcmd.(*Reloader).reload.func1"
  },
  "service.name": "apm-server"
}

```
