.. meta:: :description: This document provides usage information for the Apache Kafka SMT org.apache.kafka.connect.transforms.InsertField. .. _insertfield: =========== InsertField =========== The following provides usage information for the |ak-tm| SMT ``org.apache.kafka.connect.transforms.InsertField``. Description ----------- Insert fields using attributes from the record metadata or a configured static value. Use the concrete transformation type designed for the record key (``org.apache.kafka.connect.transforms.InsertField$Key``) or value (``org.apache.kafka.connect.transforms.InsertField$Value``). Example ------- This configuration snippet shows how to use ``InsertField`` to insert a static field labeled ``MessageSource`` using a static value of ``Kafka Connect Framework``. .. code-block:: json "transforms": "InsertField", "transforms.InsertField.type": "org.apache.kafka.connect.transforms.InsertField$Value", "transforms.InsertField.static.field": "MessageSource", "transforms.InsertField.static.value": "Kafka Connect framework" Before: ``{"author": "Philip K. Dick", "character": "Palmer Eldritch"}`` After: ``{"author": "Philip K. Dick", "character": "Palmer Eldritch", "MessageSource": "Kafka Connect framework"}`` .. tip:: For additional examples, see `Insert Field `__ for managed connectors. Properties ---------- .. list-table:: :header-rows: 1 :widths: 15 30 10 10 10 10 * - Name - Description - Type - Default - Valid Values - Importance * - ``offset.field`` - Field name for |ak-tm| offset. This is only applicable to sink connectors. Suffix with ``!`` to make this a required field, or ``?`` to keep it optional (the default). - string - null - - medium * - ``partition.field`` - Field name for |ak| partition. Suffix with ``!`` to make this a required field, or ``?`` to keep it optional (the default). - string - null - - medium * - ``static.field`` - Field name for static data field. Suffix with ``!`` to make this a required field, or ``?`` to keep it optional (the default). - string - null - - medium * - ``static.value`` - If field name is configured, the static field value. - string - null - - medium * - ``timestamp.field`` - Field name for record timestamp. Suffix with ``!`` to make this a required field, or ``?`` to keep it optional (the default). - string - null - - medium * - ``topic.field`` - Field name for |ak| topic. Suffix with ``!`` to make this a required field, or ``?`` to keep it optional (the default). - string - null - - medium .. include:: includes/predicate.rst