# Processor event variable interpolation

**URL:** <https://discuss.elastic.co/t/processor-event-variable-interpolation/183434>\
**Category:** Beats\
**Created:** [May 29, 2019, 11:41pm UTC](https://discuss.elastic.co/t/processor-event-variable-interpolation/183434 "2019-05-29T23:41:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![justinw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/justinw/32/40277_2.png) [@justinw](https://discuss.elastic.co/u/justinw)\
**Post date:** [May 29, 2019, 11:41pm UTC](https://discuss.elastic.co/t/processor-event-variable-interpolation/183434/1 "2019-05-29T23:41:38Z")

</div>

Hi,

Hopefully a quick one. I want to add document metadata via processors, however the value depends on event values.

How would I get something like this to work? I tried the following formats with no luck.

```auto
processors:
- add_fields:
    when:
      has_fields: ['container.name']
    target: internal_namespace
    fields:
      a: '%{container.name}'
      b: '%{data.container.name}'
      c: '%{[container][name]}'
      d: '%{[data][container][name]}'
      e: container.name
      f: data.container.name

```

Thanks, Justin

---

<div class="post-metadata">

**Author:** ![martinr\_ubi](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@martinr\_ubi](https://discuss.elastic.co/u/martinr_ubi)\
**Post date:** [May 30, 2019, 1:33am UTC](https://discuss.elastic.co/t/processor-event-variable-interpolation/183434/2 "2019-05-30T01:33:50Z")

</div>

Hi,

The [format strings](https://www.elastic.co/guide/en/beats/libbeat/current/config-file-format-type.html#_format_string_sprintf) you're trying are not supported in processors.  
So none of the ones your tried is written correctly but even if it was, it wouldn't work.

But the dissect processor is made to do that:

```auto
processors:
  - dissect:
      tokenizer: "%{a}"
      field: "container.id"
      target_prefix: "internal_namespace"

```

Should give:

```auto
"internal_namespace": {
   "a": "f99a1886631e817d33e37238d7224ad6cad5c417978a8e6cfc2e307662d956bc"
},
"container": {
   "id": "f99a1886631e817d33e37238d7224ad6cad5c417978a8e6cfc2e307662d956bc"
}

```

Edit: It's made... to do a lot more than that, but it can do just that too.

---

<div class="post-metadata">

**Author:** ![justinw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/justinw/32/40277_2.png) [@justinw](https://discuss.elastic.co/u/justinw)\
**Post date:** [May 30, 2019, 1:56am UTC](https://discuss.elastic.co/t/processor-event-variable-interpolation/183434/3 "2019-05-30T01:56:22Z")

</div>

This is what I was looking for, thanks!

---

<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:** [June 27, 2019, 3:56am UTC](https://discuss.elastic.co/t/processor-event-variable-interpolation/183434/4 "2019-06-27T03:56:24Z")

</div>

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