# Logstash pipeline to pipeline - send\_to field variable

**URL:** <https://discuss.elastic.co/t/logstash-pipeline-to-pipeline-send-to-field-variable/301625>\
**Category:** Logstash\
**Created:** [April 5, 2022, 11:36am UTC](https://discuss.elastic.co/t/logstash-pipeline-to-pipeline-send-to-field-variable/301625 "2022-04-05T11:36:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahmed\_charafouddine](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ahmed_charafouddine/32/45129_2.png) [@ahmed\_charafouddine](https://discuss.elastic.co/u/ahmed_charafouddine)\
**Post date:** [April 5, 2022, 11:36am UTC](https://discuss.elastic.co/t/logstash-pipeline-to-pipeline-send-to-field-variable/301625/1 "2022-04-05T11:36:04Z")

</div>

Hello,

I am working on the use of pipeline-to-pipeline. I wanted to value a variable and then use it in send\_to of the pipeline plugin.

idea to avoid the use of several if..else conditions which surely have an impact on the performance of logstash.

but unfortunately, the field fails to be valued once in the send\_to.

```auto
input {

      # ESB blablabla
    stdin {}
}
filter {
    grok { match => {"message" => "%{WORD:appTrigrammeCible}%{SPACE}%{GREEDYDATA:other}"}}
    mutate {
        
        add_field => {
            "[@metedata][output_id]" => "%{}" # OK
        }
    }
}

output {
    pipeline {
        send_to => [%{[@metedata][output_id]} ]
    }
}

```

An idea ?

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [April 5, 2022, 2:02pm UTC](https://discuss.elastic.co/t/logstash-pipeline-to-pipeline-send-to-field-variable/301625/2 "2022-04-05T14:02:24Z")

</div>

It is not possible, the `send_to` option does not support sprintf expansion, so it will try to output to a pipeline with the literal name of `%{[metadata][output_id]}`.

You will need to use the if else conditions, but I don't think this will have any considerable impact in the performance.

I do not have any benchmarks about this case, but I've run pipelines with many if/else conditions in the output without any impact, a single grok filter probably has more impact in the performance than many simple conditionals check.

---

<div class="post-metadata">

**Author:** ![ahmed\_charafouddine](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ahmed_charafouddine/32/45129_2.png) [@ahmed\_charafouddine](https://discuss.elastic.co/u/ahmed_charafouddine)\
**Post date:** [April 5, 2022, 2:10pm UTC](https://discuss.elastic.co/t/logstash-pipeline-to-pipeline-send-to-field-variable/301625/3 "2022-04-05T14:10:30Z")

</div>

Thanks for your return. I think I'll combine the if..else.

---

<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:** [May 3, 2022, 2:11pm UTC](https://discuss.elastic.co/t/logstash-pipeline-to-pipeline-send-to-field-variable/301625/4 "2022-05-03T14:11:27Z")

</div>

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