# Capturing servername and appending/propogating it to all other lines of logfile

**URL:** <https://discuss.elastic.co/t/capturing-servername-and-appending-propogating-it-to-all-other-lines-of-logfile/277876>\
**Category:** Logstash\
**Created:** [July 5, 2021, 6:53pm UTC](https://discuss.elastic.co/t/capturing-servername-and-appending-propogating-it-to-all-other-lines-of-logfile/277876 "2021-07-05T18:53:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nanelastic](https://avatars.discourse-cdn.com/v4/letter/n/b5e925/32.png) [@Nanelastic](https://discuss.elastic.co/u/Nanelastic)\
**Post date:** [July 5, 2021, 6:53pm UTC](https://discuss.elastic.co/t/capturing-servername-and-appending-propogating-it-to-all-other-lines-of-logfile/277876/1 "2021-07-05T18:53:45Z")

</div>

Hello Guys,  
I am very new to ELK stack. I am trying to parse below mentioned log using logstash config.  
I figured out the grok pattern for last 3 lines. I need help in capturing the server name mentioned in either line1 or line 4 and append it to last 3 lines.

is this possible?

**below is logfile :**  
XYZ V5.0; Process Startup; Server:MATLK657N1;  
06-JUN-2020 12:03:31.61

* * *

H Machine:MATLK657N1,Date:20220607.12.03.31.61  
S Id:{1137-47E8-A5B0-601C86B166CD},Method:DFSList(),Start:06-JUN-2021  
C Id:{1137-47E8-A5B0-671C86B166CF},Method:DFSList(),end:06-JUN-2021  
S Id:{1137-47E8-A5B0-691C86B166AC},Method:DFSList(),Start:06-JUN-2021

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [July 5, 2021, 8:43pm UTC](https://discuss.elastic.co/t/capturing-servername-and-appending-propogating-it-to-all-other-lines-of-logfile/277876/2 "2021-07-05T20:43:41Z")

</div>

There is an example of capturing data from one line and adding it to others [here](https://discuss.elastic.co/t/how-to-parse-dir-command-output-from-txt-file-and-append-filenames-to-directory/276185/4). Note the prerequisites at the end of that post.

---

<div class="post-metadata">

**Author:** ![Nanelastic](https://avatars.discourse-cdn.com/v4/letter/n/b5e925/32.png) [@Nanelastic](https://discuss.elastic.co/u/Nanelastic)\
**Post date:** [July 6, 2021, 3:39pm UTC](https://discuss.elastic.co/t/capturing-servername-and-appending-propogating-it-to-all-other-lines-of-logfile/277876/3 "2021-07-06T15:39:18Z")

</div>

This was super helpful. Thanks a ton!!

---

<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:** [August 3, 2021, 3:40pm UTC](https://discuss.elastic.co/t/capturing-servername-and-appending-propogating-it-to-all-other-lines-of-logfile/277876/4 "2021-08-03T15:40:16Z")

</div>

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