Integrate Apache Kafka with Google SecOps

Supported in:

This document explains how to integrate Apache Kafka with Google Security Operations.

Integrating Apache Kafka with Google SecOps lets you pull security messages directly from Kafka topics into alerts and trigger automated response playbooks.

Use cases

The Apache Kafka integration uses Google SecOps capabilities to support the following use cases:

  • Streaming security event ingestion: Pull security telemetry and application logs from Apache Kafka topics into Google SecOps alerts for centralized triage.

  • Event-driven playbook execution: Trigger automated response playbooks in Google SecOps when high-priority security messages arrive on monitored Kafka topics.

  • Dynamic alert naming and severity mapping: Populate Google SecOps alert names, case names, rule generators, and priority scores directly from fields in your Kafka messages.

Before you begin

Before you configure the Apache Kafka integration in Google SecOps, verify that your environment meets the following requirements:

  • Network connectivity and remote agent: Make sure that Google SecOps can reach your Apache Kafka brokers. For private clusters, deploy a Debian-based Google SecOps remote agent using either the Debian installer or Docker with the Debian container image:

    us-docker.pkg.dev/siem-ar-public/images/agent-debian:latest
    
  • Supported message formats: Publish UTF-8 JSON objects or plain text to the target topic. Binary formats, such as Apache Avro and Protocol Buffers, aren't supported.

  • Base64-encoded TLS certificates: For TLS or mutual TLS broker connections (see the Apache Kafka security documentation), encode certificates and private keys as single-line Base64 strings. Don't paste raw PEM text with -----BEGIN CERTIFICATE----- headers:

    # Linux
    base64 -w 0 ca-cert.pem
    
    # macOS
    base64 -i ca-cert.pem | tr -d '\n'
    
  • Kafka access control list permissions: If your cluster enforces Apache Kafka access control lists, grant at least the following permissions:

Component Required Apache Kafka permissions
Ping Describe on the cluster or topics.
Apache Kafka - Messages Connector Read and Describe on the target Topic, plus Read on Consumer group ID when using a consumer group.

Integration parameters

Choose the parameter combination that matches how your Apache Kafka cluster authenticates clients:

Authentication mode Parameters to configure
Unencrypted (no authentication) Configure Kafka Brokers only. Leave both TLS options disabled and leave all certificate and SASL fields empty.
TLS server verification Enable Use TLS for connection and configure CA certificate of Kafka server.
Mutual TLS Enable Use TLS for connection and configure CA certificate of Kafka server, Client certificate, and Client certificate key (include Client certificate key password if the private key is password-protected).
SASL PLAIN over TLS Enable Use SASL PLAIN with TLS for connection and configure CA certificate of Kafka server, SASL PLAIN Username, and SASL PLAIN Password (include optional client certificate fields if your cluster also requires mutual TLS).
SASL PLAIN without TLS Leave both TLS options disabled and configure SASL PLAIN Username and SASL PLAIN Password.

The Apache Kafka integration requires the following parameters:

Parameter Description
Kafka Brokers

Required.

A comma-separated list of Kafka brokers formatted as HOSTNAME:PORT.

Use TLS for connection

Optional.

If selected, the integration encrypts broker connections with TLS.

When selected, also configure CA certificate of Kafka server.

Disabled by default.

Use SASL PLAIN with TLS for connection

Optional.

If selected, the integration authenticates using SASL PLAIN over TLS.

When selected, also configure SASL PLAIN Username, SASL PLAIN Password, and CA certificate of Kafka server.

Disabled by default.

CA certificate of Kafka server

Optional.

The Base64-encoded CA certificate used to verify the Kafka server.

When using a TLS option, this parameter is required.

Client certificate

Optional.

The Base64-encoded client certificate for mutual TLS authentication.

When authenticating with mutual TLS, also configure CA certificate of Kafka server and Client certificate key.

Client certificate key

Optional.

The Base64-encoded private key for Client certificate.

Client certificate key password

Optional.

The password for Client certificate key, if encrypted.

SASL PLAIN Username

Optional.

The username for SASL PLAIN authentication.

When authenticating with SASL PLAIN (with or without TLS), this parameter is required.

SASL PLAIN Password

Optional.

The password for SASL PLAIN authentication.

When authenticating with SASL PLAIN (with or without TLS), this parameter is required.

For instructions about how to configure an integration in Google SecOps, see Configure integrations.

You can make changes at a later stage, if needed. After you configure an integration instance, you can use it in playbooks. For more information about how to configure and support multiple instances, see Supporting multiple instances.

Actions

For more information about actions, see Respond to pending actions from your workdesk and Run a manual action in your case.

Ping

Use the Ping action to test connectivity and verify that your configured broker addresses, certificates, and credentials can reach the Apache Kafka cluster.

This action doesn't run on Google SecOps entities.

Action inputs

None.

Action outputs

The Ping action provides the following outputs:

Action output type Availability
Case wall attachment Not available
Case wall link Not available
Case wall table Not available
Entity enrichment table Not available
JSON result Not available
Output messages Available
Script result Available
Output messages

The Ping action provides the following output messages:

Output message Message description
Successfully connected to the Apache Kafka server with the provided connection parameters! The action succeeded.
Failed to connect to the Apache Kafka server! Reason: ERROR_REASON

The action failed.

Verify Kafka Brokers, SASL credentials, and Base64-encoded TLS certificates.

Script result

The following table lists the value for the script result output when using the Ping action:

Script result name Value
is_success true or false

Connectors

To learn more about configuring connectors in Google SecOps, see Ingest your data (connectors).

Apache Kafka - Messages Connector

Use the Apache Kafka - Messages Connector to ingest messages from an Apache Kafka topic as Google SecOps alerts. This connector configures its own broker, TLS, and SASL settings independently using the authentication modes in Integration parameters.

Each message creates an alert (default vendor Apache Kafka, default product Message) with string field values and Kafka metadata (topic, partition, offset, timestamp, key, and headers_HEADER_NAME):

  • JSON messages: Prefixes fields with data_, separates nested keys with underscores (for example, {"event": {"severity": "Malicious"}} becomes data_event_severity), and numbers list items starting at _1 (such as data_ips_1). Product Field Name, Event Field Name, Environment Field Name, Severity Mapping JSON, and event mapping require flattened underscore names (such as data_event_severity), whereas template, timestamp, and unique ID parameters accept either dot notation (data.event.id) or underscore names (data_event_id).
  • Plain-text messages: Stores non-JSON text in the data field.

Choose how to track read messages

Choose one of the following modes to track read progress:

  • Kafka consumer group: Configure the Consumer group ID and leave Partitions and Initial Offset empty. Kafka assigns partitions and tracks offsets automatically (starting from earliest for a new group).
  • Partition offset tracking in Google SecOps: Leave Consumer group ID empty, optionally specify Partitions and Initial Offset, and let Google SecOps track the last read offset for each partition between runs.

JSON severity mapping

Use the Severity Mapping JSON connector parameter to map fields from your Kafka messages to Google SecOps alert priority scores:

Priority score Google SecOps severity
100 Critical
From 80 to 99 High
From 60 to 79 Medium
From 40 to 59 Low
Less than 40 (including -1) Informational

By default, Severity Mapping JSON uses the following configuration:

{
  "Default": 60
}

The "Default" key is required and sets the fallback priority score when none of your configured fields match a message.

  • Map text severity labels: If your JSON message contains text severity values (such as "Malicious", "Unknown", or "Benign" in an event_severity field, which becomes data_event_severity), map each text value to a priority score:

    {
      "data_event_severity": {
        "Malicious": 100,
        "Unknown": 60,
        "Benign": -1
      },
      "Default": 50
    }
    

    If multiple configured fields appear in the same message, the Apache Kafka - Messages Connector uses the first matching field listed in Severity Mapping JSON.

  • Use numeric severity scores directly: If a message field already contains a valid numeric score when present (such as 85 or 72.5), set its value to an empty string (""). The connector uses that number (rounded to the nearest whole number) as the priority score:

    {
      "data_risk_score": "",
      "Default": 60
    }
    

Connector inputs

The Apache Kafka - Messages Connector requires the following parameters:

Parameter Description
Product Field Name

Required.

The field name used to determine the product name. Use the flattened underscore name for JSON fields (such as data_product). If the specified field isn't found, the alert product defaults to Message.

The default value is Product Name.

Event Field Name

Required.

The name of the field that determines the event name (subtype).

Use the flattened underscore name for JSON fields (for example, a JSON event_type key becomes data_event_type).

The default value is event_type.

Environment Field Name

Optional.

The name of the field where the environment name is stored.

If the environment field is missing, the connector uses the default value.

Use the flattened underscore name for JSON fields (such as data_environment).

Environment Regex Pattern

Optional.

A regular expression pattern to run on the value found in the Environment Field Name field. This parameter lets you manipulate the environment field using the regular expression logic.

Use the default value .* to retrieve the required raw Environment Field Name value.

If the regular expression pattern is null or empty, or the environment value is null, the final environment result is the default environment.

Script Timeout (Seconds)

Required.

The timeout limit, in seconds, for the Python process that runs the current script.

The default value is 180.

Kafka Brokers

Required.

A comma-separated list of Kafka brokers formatted as HOSTNAME:PORT.

Use TLS for connection

Optional.

If selected, the connector encrypts broker connections with TLS.

When selected, also configure CA certificate of Kafka server.

Disabled by default.

Use SASL PLAIN with TLS for connection

Optional.

If selected, the connector authenticates using SASL PLAIN over TLS.

When selected, also configure SASL PLAIN Username, SASL PLAIN Password, and CA certificate of Kafka server.

Disabled by default.

CA certificate of Kafka server

Optional.

The Base64-encoded CA certificate used to verify the Kafka server.

When a TLS option is enabled, this parameter is required.

Client certificate

Optional.

The Base64-encoded client certificate for mutual TLS authentication.

When authenticating with mutual TLS, also configure CA certificate of Kafka server and Client certificate key.

Client certificate key

Optional.

The Base64-encoded private key for Client certificate.

Client certificate key password

Optional.

The password for Client certificate key, if encrypted.

SASL PLAIN Username

Optional.

The username for SASL PLAIN authentication.

When authenticating with SASL PLAIN (with or without TLS), this parameter is required.

SASL PLAIN Password

Optional.

The password for SASL PLAIN authentication.

When authenticating with SASL PLAIN (with or without TLS), this parameter is required.

Topic

Required.

The Apache Kafka topic to read messages from.

Consumer group ID

Optional.

The Kafka consumer group ID.

When configured, leave Partitions and Initial Offset empty.

If you don't provide a consumer group ID, Google SecOps tracks read offsets for each partition.

Partitions

Optional.

A comma-separated list of partition numbers to read from (such as 0,1,2), or blank for all partitions.

When using a Consumer group ID, leave this field empty.

Initial Offset

Optional.

The starting offset on a partition during the first connector run.

When using Consumer group ID, leave this field empty.

The possible values are as follows:

  • earliest (default when omitted): Oldest available message.
  • latest: New messages arriving after the connector runs.
  • A non-negative whole number (such as 100): Specific message offset.
Max Messages To Fetch

Required.

The maximum number of messages to ingest during each connector run.

The default value is 100.

Poll Timeout

Optional.

The maximum number of seconds to wait when polling Kafka (positive whole numbers only).

The default value is 5.

Case Name Template

Optional.

A template that populates the custom_case_name event field using placeholders in square brackets (such as Phishing - [data.mailbox] or Phishing - [data_mailbox]) for use in playbooks or case naming.

Alert Name Template

Required.

A template for the alert name using field placeholders in square brackets (such as Phishing - [data.mailbox]).

Falls back to CONNECTOR_NAME - Alert if empty.

Rule Generator Template

Required.

A template for the rule generator value using field placeholders in square brackets (such as Detection - [data.rule_name]).

Falls back to CONNECTOR_NAME - Rule Generator if empty.

Timestamp Field

Required.

The field that sets the alert timestamp.

Include this field in every message, or the connector run fails.

Provide numeric values in Unix epoch milliseconds (such as the built-in Kafka timestamp field).

Formatted date strings (such as data.event_time) are parsed using Timestamp Format.

The default value is timestamp.

Timestamp Format

Optional.

The strftime and strptime date pattern used when Timestamp Field contains a formatted date string.

The default value is %Y-%m-%dT%H:%M:%S.%fZ.

Severity Mapping JSON

Required.

A JSON object mapping flattened message fields to alert priority scores, including a required "Default" score. See JSON severity mapping.

The default value is {"Default": 60}.

Unique ID Field

Optional.

The field (such as data.event.id or offset) used to prevent duplicate alerts.

If you don't provide a value, or if the value is missing from a message, the connector hashes the raw message body, which skips subsequent messages that have identical bodies.

Disable Overflow

Optional.

If selected, the connector ignores the Google SecOps overflow mechanism.

Enabled by default.

Verify SSL

Required.

Keep this option selected. To enable TLS certificate verification for Kafka brokers, configure Use TLS for connection (or Use SASL PLAIN with TLS for connection) and CA certificate of Kafka server.

Enabled by default.

Proxy Server Address

Optional.

Leave empty. Direct Kafka broker connections don't support HTTP proxies. For private Kafka clusters, deploy a Google SecOps remote agent. If the remote agent host requires an outbound proxy to reach Google SecOps, configure that proxy on the remote agent rather than in this field.

Proxy Username

Optional.

Leave empty. HTTP proxies aren't supported.

Proxy Password

Optional.

Leave empty. HTTP proxies aren't supported.

Connector rules

The following rules govern how the Apache Kafka - Messages Connector processes messages:

  • Proxies: The connector doesn't support HTTP or HTTPS proxies for Kafka broker connections.
  • Allowlists and blocklists: The connector doesn't support Google SecOps connector allowlist or blocklist rules.

Connector events

Suppose a producer publishes the following JSON message to the security-events Kafka topic with message key auth-service and header source: edr-gateway:

{
  "event": {
    "id": "evt-98412",
    "type": "suspicious_login",
    "severity": "Malicious"
  },
  "src_ip": "198.51.100.24",
  "mailbox": "jdoe@example.com"
}

When Case Name Template is set to Phishing - [data.mailbox], the Apache Kafka - Messages Connector creates the following Google SecOps event:

{
  "topic": "security-events",
  "partition": "0",
  "offset": "1042",
  "timestamp": "1725029077973",
  "key": "auth-service",
  "headers_source": "edr-gateway",
  "data_event_id": "evt-98412",
  "data_event_type": "suspicious_login",
  "data_event_severity": "Malicious",
  "data_src_ip": "198.51.100.24",
  "data_mailbox": "jdoe@example.com",
  "custom_case_name": "Phishing - jdoe@example.com"
}

Need more help? Get answers from Community members and Google SecOps professionals.