# How to use dynamic string in outout

**URL:** <https://discuss.elastic.co/t/how-to-use-dynamic-string-in-outout/143661>\
**Category:** Logstash\
**Created:** [August 9, 2018, 9:17am UTC](https://discuss.elastic.co/t/how-to-use-dynamic-string-in-outout/143661 "2018-08-09T09:17:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Uncel\_wang\_shushu](https://avatars.discourse-cdn.com/v4/letter/u/e36b37/32.png) [@Uncel\_wang\_shushu](https://discuss.elastic.co/u/Uncel_wang_shushu)\
**Post date:** [August 9, 2018, 9:17am UTC](https://discuss.elastic.co/t/how-to-use-dynamic-string-in-outout/143661/1 "2018-08-09T09:17:06Z")

</div>

I want to use a dynamic string to replace the result as follow :

{  
"DISMAN-EXPRESSION-MIB::sysUpTimeInstance" =\> "71 days, 04:40:14.91",  
"@timestamp" =\> 2018-08-09T09:02:37.423Z,  
"type" =\> "snmptrap",  
"host" =\> "10.158.1.211",  
"SNMPv2-MIB::snmpTrapOID.0" =\> "DELL-RAC-MIB::dell",  
"message" =\> "#\<SNMP::SNMPv2\_Trap:0x3bad2c92 @request\_id=1421128105, @error\_index=0, @error\_status=0, @source\_ip="10.158.1.211", @varbind\_list=[#\<SNMP::VarBind:0x16675511 @name=[1.3.6.1.2.1.1.3.0], @value=#\<SNMP::TimeTicks:0x1b1701ac @value=615121491\>\>, #\<SNMP::VarBind:0x490c67e0 @name=[1.3.6.1.6.3.1.1.4.1.0], @value=[1.3.6.1.4.1.674]\>, #\<SNMP::VarBind:0x2bcca0aa @name=[1.3.6.1.4.1.674.10892.2.0.1005], @value="test"\>]\>",  
"DELL-RAC-MIB::alertDrscPowerOff" =\> "test",  
"@version" =\> "1"  
}

---

<div class="post-metadata">

**Author:** ![Uncel\_wang\_shushu](https://avatars.discourse-cdn.com/v4/letter/u/e36b37/32.png) [@Uncel\_wang\_shushu](https://discuss.elastic.co/u/Uncel_wang_shushu)\
**Post date:** [August 9, 2018, 9:18am UTC](https://discuss.elastic.co/t/how-to-use-dynamic-string-in-outout/143661/2 "2018-08-09T09:18:41Z")

</div>

like %{all the field}, is these any string that can be used to replace it ?  
Thank you very much.

---

<div class="post-metadata">

**Author:** ![Uncel\_wang\_shushu](https://avatars.discourse-cdn.com/v4/letter/u/e36b37/32.png) [@Uncel\_wang\_shushu](https://discuss.elastic.co/u/Uncel_wang_shushu)\
**Post date:** [August 9, 2018, 9:24am UTC](https://discuss.elastic.co/t/how-to-use-dynamic-string-in-outout/143661/3 "2018-08-09T09:24:00Z")

</div>

The configure file is as below ,and I want to execute a command " java -jar /tmp/notify.jar %{ all the fields } " . how to use dynamic string to replace all the fields ?

input {  
snmptrap {  
type =\> "snmptrap"  
community =\> "gdsTest01"  
host =\> "0.0.0.0"  
port =\> 7777  
yamlmibdir =\> "/data/logstash-6.3.0/vendor/bundle/jruby/2.3.0/gems/snmp-1.2.0/data/ruby/snmp/mibs"  
}  
}

output {  
exec {  
command =\> "java -jar /tmp/notify.jar %{ all the fields }

"  
}  
stdout {  
codec =\> rubydebug  
}  
}

---

<div class="post-metadata">

**Author:** ![Uncel\_wang\_shushu](https://avatars.discourse-cdn.com/v4/letter/u/e36b37/32.png) [@Uncel\_wang\_shushu](https://discuss.elastic.co/u/Uncel_wang_shushu)\
**Post date:** [August 10, 2018, 2:34am UTC](https://discuss.elastic.co/t/how-to-use-dynamic-string-in-outout/143661/4 "2018-08-10T02:34:43Z")

</div>

help

---

<div class="post-metadata">

**Author:** ![Uncel\_wang\_shushu](https://avatars.discourse-cdn.com/v4/letter/u/e36b37/32.png) [@Uncel\_wang\_shushu](https://discuss.elastic.co/u/Uncel_wang_shushu)\
**Post date:** [August 10, 2018, 4:06am UTC](https://discuss.elastic.co/t/how-to-use-dynamic-string-in-outout/143661/5 "2018-08-10T04:06:07Z")

</div>

Any one knows ,thanks very much

---

<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:** [September 7, 2018, 4:06am UTC](https://discuss.elastic.co/t/how-to-use-dynamic-string-in-outout/143661/6 "2018-09-07T04:06:13Z")

</div>

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