# Insert first lines as fields to each line

**URL:** https://discuss.elastic.co/t/insert-first-lines-as-fields-to-each-line/177385
**Category:** Logstash
**Created:** [April 18, 2019, 12:54am UTC](https://discuss.elastic.co/t/insert-first-lines-as-fields-to-each-line/177385 "2019-04-18T00:54:28Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![charles.liu](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@charles.liu](https://discuss.elastic.co/u/charles.liu)
#### Post date: [April 18, 2019, 12:54am UTC](https://discuss.elastic.co/t/insert-first-lines-as-fields-to-each-line/177385/1 "2019-04-18T00:54:28Z")

</div>

Hi all  
I am new to ELK and Logstash. Here is my question:  
I have raw log file, content like below:  
AA:aa  
BB:bb  
a1,b1,c1,d1  
a2,b2,c2,d2  
a3,b3,c3,d3  
a4,b4,c4,d4

My question is how to setup the configure so my final input can be

AA:aa BB:bb a1,b1,c1,d1  
AA:aa BB:bb a2,b2,c2,d2  
AA:aa BB:bb a3,b3,c3,d3  
AA:aa BB:bb a4,b4,c4,d4

or just like below, as AA and BB is the field name.

aa,bb,a1,b1,c1,d1  
aa,bb,a2,b2,c2,d2  
aa,bb,a3,b3,c3,d3  
aa,bb,a4,b4,c4,d4

---

<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: [April 18, 2019, 2:01pm UTC](https://discuss.elastic.co/t/insert-first-lines-as-fields-to-each-line/177385/2 "2019-04-18T14:01:53Z")

</div>

[This](https://discuss.elastic.co/t/how-to-handle-metadata-in-file-headers/167544) thread might help you, but realize that this is fragile, and does not scale because you have to have '--pipeline.workers 1'

---

<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 16, 2019, 2:01pm UTC](https://discuss.elastic.co/t/insert-first-lines-as-fields-to-each-line/177385/3 "2019-05-16T14:01:54Z")

</div>

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