---
title: "kafka: Publish messages to Apache Kafka"
url: "https://axoflow.com/docs/axosyslog-core/4.28/chapter-destinations/configuring-destinations-kafka/"
last_modified: "2026-08-02T11:39:11+02:00"
---

> For the complete documentation index, see [llms.txt](https://axoflow.com/docs/axosyslog-core/4.28/llms.txt).

# kafka: Publish messages to Apache Kafka

The `kafka()` destination publishes log messages to the [Apache Kafka](http://kafka.apache.org) message bus, where subscribers can access them.

`kafka()` is a configuration snippet of the AxoSyslog Configuration Library (SCL) that calls the [`kafka-c()`](https://axoflow.com/docs/axosyslog-core/4.28/chapter-destinations/configuring-destinations-kafka-c/index.md) destination and passes on every option unchanged. The two names behave identically, use whichever you prefer. You can find the source of this configuration snippet on [GitHub](https://github.com/axoflow/axosyslog/blob/main/scl/kafka/kafka.conf).

> **Note:**
>
> Earlier versions of syslog-ng had a separate Java implementation of the `kafka()` destination that used the official Java Kafka producer. AxoSyslog has removed that implementation: `kafka()` now always uses the C implementation, which builds on the [librdkafka](https://github.com/confluentinc/librdkafka) client library, scales better, and uses much less memory.
>
> The Java implementation used different option names. If you’re migrating such a configuration, see [Shifting from Java implementation to C implementation](https://axoflow.com/docs/axosyslog-core/4.28/chapter-destinations/configuring-destinations-kafka-c/destination-kafka-c-from-java/index.md).

## Prerequisites

- Install the `axosyslog-scl` package on [Debian/Ubuntu](https://axoflow.com/docs/axosyslog-core/4.28/install/debian-ubuntu/index.md). On [RHEL and compatible distributions](https://axoflow.com/docs/axosyslog-core/4.28/install/rhel-fedora-almalinux/index.md), the SCL files are part of the `axosyslog` base package.

  Your configuration must also contain `@include "scl.conf"`, which the default configuration file already does. If the SCL files are missing, AxoSyslog fails to start with an [`unexpected LL_IDENTIFIER` error](https://axoflow.com/docs/axosyslog-core/4.28/chapter-troubleshooting-syslog-ng/unexpected-ll-identifier/index.md).

  ```shell
  @include "scl.conf"
  ```
- This feature requires a separate module. Install the `axosyslog-mod-rdkafka` package on [Debian/Ubuntu](https://axoflow.com/docs/axosyslog-core/4.28/install/debian-ubuntu/index.md), or the `axosyslog-kafka` package on [RHEL and compatible distributions](https://axoflow.com/docs/axosyslog-core/4.28/install/rhel-fedora-almalinux/index.md). If the module isn’t installed, AxoSyslog fails to start with an [`unexpected LL_IDENTIFIER` error](https://axoflow.com/docs/axosyslog-core/4.28/chapter-troubleshooting-syslog-ng/unexpected-ll-identifier/index.md).

## Declaration:

```shell
@include "scl.conf"

kafka(
    bootstrap-servers("1.2.3.4:9092,192.168.0.2:9092")
    topic("${HOST}")
);
```

## Example: Sending log data to Apache Kafka

The following example defines a `kafka` destination, using only the required options.

```shell
@include "scl.conf"

destination d_kafka {
  kafka(
    bootstrap-servers("1.2.3.4:9092,192.168.0.2:9092")
    topic("${HOST}")
  );
};
```

## Options

The `kafka()` destination accepts the options of the `kafka-c()` destination. For the list of options, see [Options of the kafka() destination’s C implementation](https://axoflow.com/docs/axosyslog-core/4.28/chapter-destinations/configuring-destinations-kafka-c/reference-destination-kafka-c/index.md).

---

[Prerequisites](https://axoflow.com/docs/axosyslog-core/4.28/chapter-destinations/configuring-destinations-kafka/destination-kafka-prerequisites/index.md)

[How AxoSyslog interacts with Apache Kafka](https://axoflow.com/docs/axosyslog-core/4.28/chapter-destinations/configuring-destinations-kafka/destination-kafka-interaction/index.md)

[Kafka destination options](https://axoflow.com/docs/axosyslog-core/4.28/chapter-destinations/configuring-destinations-kafka/reference-destination-kafka/index.md)

Last modified August 2, 2026: [Adds required modules/packages to install and destination pages (553d6d9b)](https://github.com/axoflow/axosyslog-core-docs/commit/553d6d9be9a0e3ef444e62cc5351dd2ac764f01d)
