# Connect the agent and agent running task in Logstash (help for parsing)

**URL:** <https://discuss.elastic.co/t/connect-the-agent-and-agent-running-task-in-logstash-help-for-parsing/74786>\
**Category:** Logstash\
**Created:** [February 12, 2017, 6:23am UTC](https://discuss.elastic.co/t/connect-the-agent-and-agent-running-task-in-logstash-help-for-parsing/74786 "2017-02-12T06:23:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cap\_Ho](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cap_ho/32/79703_2.png) [@Cap\_Ho](https://discuss.elastic.co/u/Cap_Ho)\
**Post date:** [February 12, 2017, 6:23am UTC](https://discuss.elastic.co/t/connect-the-agent-and-agent-running-task-in-logstash-help-for-parsing/74786/1 "2017-02-12T06:23:37Z")

</div>

Hi all,  
i am new to logstash and ask for the help in the following condition.

i will use a engine to run different java programs. each engine will have a session id and trigger the java program sequentially with job . But the java program don't have any knowledge about which engine is trigger the java program. So in the engine log , it will look like:

**[INFO] Engine section:123456 job:123 start**  
**[INFO] Java program A: start**  
**[INFO] java program A: running**  
**[INFO] java program A: end**  
**[INFO] Engine section:123456 job:123 end**

**[INFO] Engine section:123456 job:124 start**  
**[INFO] Java program B: start**  
**[INFO] java program B: error**  
**[INFO] Engine section:123456 job:124 end**

i am wondering how we can use logstash plugins (if there are any), which may group the Engine job and engine run java program together (e.g use the plugins and add the section and job info to the java program log). So in kibana i may use the query and easily search all the log related to "section 123456 , job 123" instead of use timestamp for help

thx

capho

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 13, 2017, 8:40am UTC](https://discuss.elastic.co/t/connect-the-agent-and-agent-running-task-in-logstash-help-for-parsing/74786/2 "2017-02-13T08:40:21Z")

</div>

Use the multiline codec, that'll do it 🙂

---

<div class="post-metadata">

**Author:** ![Cap\_Ho](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cap_ho/32/79703_2.png) [@Cap\_Ho](https://discuss.elastic.co/u/Cap_Ho)\
**Post date:** [February 13, 2017, 11:33pm UTC](https://discuss.elastic.co/t/connect-the-agent-and-agent-running-task-in-logstash-help-for-parsing/74786/3 "2017-02-13T23:33:18Z")

</div>

Thx .

just have one more question. Since the multiline codec will merge the several event to one based on the pattern. I would like to know if there are some other plugins which i may put the section and job id in the java program. Since i would like to keep the log as a individual . But also add the section and job id inside the java program log so that i may use it as a key for filter in Kibana

capho

---

<div class="post-metadata">

**Author:** ![Cap\_Ho](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cap_ho/32/79703_2.png) [@Cap\_Ho](https://discuss.elastic.co/u/Cap_Ho)\
**Post date:** [February 19, 2017, 7:05am UTC](https://discuss.elastic.co/t/connect-the-agent-and-agent-running-task-in-logstash-help-for-parsing/74786/4 "2017-02-19T07:05:28Z")

</div>

to be more specified , what i want is just add the session id and job id into the json when logstash parse the log (i cannot do it in source code level since the java program don't have any information about the session and job)  
i want to like to make it like from:

[INFO] Engine section:123456 job:123 start  
[INFO] Java program A: start  
[INFO] java program A: running  
[INFO] java program A: end  
[INFO] Engine section:123456 job:123 end  
[INFO] Engine section:123456 job:124 start  
[INFO] Java program B: start  
[INFO] java program B: error  
[INFO] Engine section:123456 job:124 end

to

[INFO] Engine section:123456 job:123 start  
[INFO] **Engine section:123456 job:123** Java program A: start  
[INFO] **Engine section:123456 job:123** java program A: running  
[INFO] **Engine section:123456 job:123** java program A: end  
[INFO] **Engine section:123456 job:123** end  
[INFO] Engine section:123456 job:124 start  
[INFO] **Engine section:123456 job:124** Java program B: start  
[INFO] **Engine section:123456 job:124** java program B: error  
[INFO] Engine section:123456 job:124 end

by doing this , i can have a field call session and job in the event so that kibana can use to display it with checking the time range.

Can some of you have any suggestion?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 19, 2017, 7:08am UTC](https://discuss.elastic.co/t/connect-the-agent-and-agent-running-task-in-logstash-help-for-parsing/74786/5 "2017-02-19T07:08:56Z")

</div>

Not sure if that is possible sorry.

---

<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:** [March 19, 2017, 7:08am UTC](https://discuss.elastic.co/t/connect-the-agent-and-agent-running-task-in-logstash-help-for-parsing/74786/6 "2017-03-19T07:08:59Z")

</div>

Closed on March 19, 2017, 7:08am UTC

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