# How to separate fields in different logs using logstash

**URL:** <https://discuss.elastic.co/t/how-to-separate-fields-in-different-logs-using-logstash/197581>\
**Category:** Logstash\
**Created:** [August 31, 2019, 4:41am UTC](https://discuss.elastic.co/t/how-to-separate-fields-in-different-logs-using-logstash/197581 "2019-08-31T04:41:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sahere37](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@sahere37](https://discuss.elastic.co/u/sahere37)\
**Post date:** [August 31, 2019, 4:41am UTC](https://discuss.elastic.co/t/how-to-separate-fields-in-different-logs-using-logstash/197581/1 "2019-08-31T04:41:14Z")

</div>

hi all,  
I have different lines of logs for example as following:

```
A1=5454;A2=34757354575;A3=setoh;A4=NU;A5=(555);A6=[78925]
B1=get;B2=589641;B3=258
C1=(5472);C2=LA;C3=Mid;C4=0000

```

I am using a csv filter in order to separate fields in above line using ";" separator. then I want to extract fields as following:  
for example for line 1, create a field such as A1 which its value is 5454, and a field named as A2 which its value be as 34757354575 and so on:  
A1=5454  
A2=34757354575  
A3=setoh  
....

How can I do it? it means, using a script which dynamically get the left part of "=" sign as field's name and right part as its value; in addition do it for different lines which have different number of fields which separated by ";"  
any advise will be so appreciated.

---

<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:** [August 31, 2019, 12:21pm UTC](https://discuss.elastic.co/t/how-to-separate-fields-in-different-logs-using-logstash/197581/2 "2019-08-31T12:21:19Z")

</div>

Use a kv filter to separate these key/value pairs

```
kv { field_split => ";" }
```

---

<div class="post-metadata">

**Author:** ![sahere37](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@sahere37](https://discuss.elastic.co/u/sahere37)\
**Post date:** [August 31, 2019, 1:08pm UTC](https://discuss.elastic.co/t/how-to-separate-fields-in-different-logs-using-logstash/197581/3 "2019-08-31T13:08:49Z")

</div>

many thanks. it works

---

<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 28, 2019, 1:08pm UTC](https://discuss.elastic.co/t/how-to-separate-fields-in-different-logs-using-logstash/197581/4 "2019-09-28T13:08:50Z")

</div>

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