# Parsing a string delimited log with Dissect

**URL:** https://discuss.elastic.co/t/parsing-a-string-delimited-log-with-dissect/156044
**Category:** Logstash
**Created:** [November 9, 2018, 12:15pm UTC](https://discuss.elastic.co/t/parsing-a-string-delimited-log-with-dissect/156044 "2018-11-09T12:15:06Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![tlenya](https://avatars.discourse-cdn.com/v4/letter/t/bbce88/32.png) [@tlenya](https://discuss.elastic.co/u/tlenya)
#### Post date: [November 9, 2018, 12:15pm UTC](https://discuss.elastic.co/t/parsing-a-string-delimited-log-with-dissect/156044/1 "2018-11-09T12:15:06Z")

</div>

Good day all,  
I am trying to parse the below log using Dissect.

1541164838.872000[20181102 16:20:38.872000] Module: PXYZ-ModuleHandler/8.1/A/1 Event: some event initialized ID: 4800001 Type: 93669594796392449 Count: 7 Aff.Obj: Info: Announcement code list 1 is not initialised! It is used in service class 5

format:  
xxxxx.xxxxx[timestamp timestamp] Module: some data Event: some data Info: some data .....

My Filter configuration looks  
filter {  
dissect {  
mapping =\> {  
"message" =\> "%{SeqNo}[%{date\_time} %{+timestamp}] %{Module}Module: %{Event}Event: %{ID}ID: %{Type}Type: %{Count}Count: %{Aff.Obj}Aff.Obj: %{Info}"  
}  
}  
}

When I get it to work, only the timestamp portions and the last element parse correctly. The rest are shifted to the right. ie. Value for Module (1st delimiter) is blank, Event takes up the value for Module and so on.

Any help will be highly appreciated.

Regards,  
Lenya

---

<div class="post-metadata">

### Author: ![guyboertje](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/guyboertje/32/31592_2.png) [@guyboertje](https://discuss.elastic.co/u/guyboertje)
#### Post date: [November 16, 2018, 4:17pm UTC](https://discuss.elastic.co/t/parsing-a-string-delimited-log-with-dissect/156044/2 "2018-11-16T16:17:10Z")

</div>

From `timestamp` onwards your patterns are backwards.  
Try:

```auto
"message" => "%{SeqNo}[%{date_time} %{+timestamp}] Module: %{Module} Event: %{Event} ID: %{ID} Type: %{Type} Count: %{Count} Aff.Obj: %{Aff.Obj} Info: %{Info}"

```

I find that if I start with the original line as a comment and the mapping then gradually replace the values I need to extract with a `%{key}` section, then the delimiters are left in the correct places.  
1

```auto
    # "message" => "1541164838.872000[20181102 16:20:38.872000] Module: PXYZ-ModuleHandler/8.1/A/1 Event: some event initialized ID: 4800001 Type: 93669594796392449 Count: 7 Aff.Obj: Info: Announcement code list 1 is not initialised! It is used in service class 5"
      "message" => "1541164838.872000[20181102 16:20:38.872000] Module: PXYZ-ModuleHandler/8.1/A/1 Event: some event initialized ID: 4800001 Type: 93669594796392449 Count: 7 Aff.Obj: Info: Announcement code list 1 is not initialised! It is used in service class 5"

```

2

```auto
      # "message" => "1541164838.872000[20181102 16:20:38.872000] Module: PXYZ-ModuleHandler/8.1/A/1 Event: some event initialized ID: 4800001 Type: 93669594796392449 Count: 7 Aff.Obj: Info: Announcement code list 1 is not initialised! It is used in service class 5"
      "message" => "%{SeqNo}[20181102 16:20:38.872000] Module: PXYZ-ModuleHandler/8.1/A/1 Event: some event initialized ID: 4800001 Type: 93669594796392449 Count: 7 Aff.Obj: Info: Announcement code list 1 is not initialised! It is used in service class 5"

```

3

```auto
      # "message" => "1541164838.872000[20181102 16:20:38.872000] Module: PXYZ-ModuleHandler/8.1/A/1 Event: some event initialized ID: 4800001 Type: 93669594796392449 Count: 7 Aff.Obj: Info: Announcement code list 1 is not initialised! It is used in service class 5"
      "message" => "%{SeqNo}[%{date_time} 16:20:38.872000] Module: PXYZ-ModuleHandler/8.1/A/1 Event: some event initialized ID: 4800001 Type: 93669594796392449 Count: 7 Aff.Obj: Info: Announcement code list 1 is not initialised! It is used in service class 5"

```

And so on until the end then I delete the comment.

---

<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: [December 14, 2018, 4:21pm UTC](https://discuss.elastic.co/t/parsing-a-string-delimited-log-with-dissect/156044/3 "2018-12-14T16:21:38Z")

</div>

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