# Need Help with Logstash Multiline Codec

**URL:** <https://discuss.elastic.co/t/need-help-with-logstash-multiline-codec/273134>\
**Category:** Logstash\
**Created:** [May 17, 2021, 7:01am UTC](https://discuss.elastic.co/t/need-help-with-logstash-multiline-codec/273134 "2021-05-17T07:01:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pemitha\_Randiya](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pemitha_randiya/32/88829_2.png) [@Pemitha\_Randiya](https://discuss.elastic.co/u/Pemitha_Randiya)\
**Post date:** [May 17, 2021, 7:01am UTC](https://discuss.elastic.co/t/need-help-with-logstash-multiline-codec/273134/1 "2021-05-17T07:01:39Z")

</div>

Here is my sample log data :

2021/05/17 12:17:41.866 | 382DC9789F284D3C9D7CC269F1851094|0000SUMMARY:[INFO]:  
2021/05/17 12:17:41.866 |---------------------------------------------------------------------  
2021/05/17 12:17:41.866 | TRANSACTION FLOW SUMMARY  
2021/05/17 12:17:41.866 |---------------------------------------------------------------------  
2021/05/17 12:17:41.866 |Transaction Type : null  
2021/05/17 12:17:41.866 |Direction : INWARD  
2021/05/17 12:17:41.866 |---------------------------------------------------------------------  
2021/05/17 12:17:41.866 |Amount : null  
2021/05/17 12:17:41.866 |From Bank : null  
2021/05/17 12:17:41.866 |From Branch : null  
2021/05/17 12:17:41.866 |From Account No : null  
2021/05/17 12:17:41.866 |From Account Name : null  
2021/05/17 12:17:41.866 |To Bank : null  
2021/05/17 12:17:41.866 |To Branch : null  
2021/05/17 12:17:41.866 |To Account No : null  
2021/05/17 12:17:41.866 |To Account Name : null  
2021/05/17 12:17:41.866 |Reference : null  
2021/05/17 12:17:41.866 |---------------------------------------------------------------------  
2021/05/17 12:17:41.866 |STAN : null  
2021/05/17 12:17:41.866 |RRN : null  
2021/05/17 12:17:41.866 |Date Time : null  
2021/05/17 12:17:41.866 |---------------------------------------------------------------------  
2021/05/17 12:17:41.866 |Status : null  
2021/05/17 12:17:41.866 |Response Code : null  
2021/05/17 12:17:41.866 |Response Desc : null  
2021/05/17 12:17:41.866 |---------------------------------------------------------------------  
2021/05/17 12:17:41.866 | COMPONENT SUMMARY  
2021/05/17 12:17:41.866 |---------------------------------------------------------------------  
2021/05/17 12:17:41.866 |Id :1: Name:API: Time-Out :8sec: State :REVERSE\_COMPLETED  
2021/05/17 12:17:41.866 |Id :2: Name:LankaPay: Time-Out :5sec: State :REVERSE\_COMPLETED  
2021/05/17 12:17:41.866 |Id :3: Name:CBS: Time-Out :11sec: State :FORWARD\_NOT\_COMPLETED  
2021/05/17 12:17:41.866 |---------------------------------------------------------------------  
2021/05/17 12:18:41.866 | 382DC9789F284D3C9D7CC269F1851094|0000SUMMARY:[INFO]: Channel is Idle

* * *

## How can i use the multiline codec to read TRANSACTION FLOW SUMMARY report as a one document like this:

```
 TRANSACTION FLOW SUMMARY 

```

* * *

## Transaction Type : null Direction : INWARD

## Amount : null From Bank : null From Branch : null From Account No : null From Account Name : null To Bank : null To Branch : null To Account No : null To Account Name : null Reference : null

## STAN : null RRN : null Date Time : null

## Status : null Response Code : null Response Desc : null

```
 COMPONENT SUMMARY 

```

* * *

## Id :1: Name:API: Time-Out :8sec: State :REVERSE\_COMPLETED Id :2: Name:LankaPay: Time-Out :5sec: State :REVERSE\_COMPLETED Id :3: Name:CBS: Time-Out :11sec: State :FORWARD\_NOT\_COMPLETED

Here is my current logstash Config  
input {  
file {  
type =\> "info"  
path =\> "C:/elastic\_stack/logstash-7.11.1/data/log\_info.txt"  
start\_position =\> "beginning"  
codec =\> multiline {  
pattern =\> "^%{DATESTAMP:timestamp}\s|\s%{GREEDYDATA:session-id}|%{WORD:channel}:[%{GREEDYDATA:log-info}]:%{GREEDYDATA:switch-message}"  
negate =\> true  
what =\> "previous"  
}  
}  
}

filter {

if [type] == "info" {  
grok {  
match =\> { "message" =\>"%{DATESTAMP:timestamp}\s|\s%{GREEDYDATA:session-id}|%{WORD:channel}:[%{GREEDYDATA:log-info}]:%{GREEDYDATA:switch-message}" }  
match =\> { "message" =\>"%{DATESTAMP:timestamp}\s|\s%{GREEDYDATA:switch-message}" }  
}  
}

}

output {  
elasticsearch {  
hosts =\> ["192.168,1.1:9200"]  
index =\> "econlogtest1234"  
}  
}

i want to read my other messages like the grok pattern i used while reading reports as a document

---

<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:** [June 14, 2021, 7:02am UTC](https://discuss.elastic.co/t/need-help-with-logstash-multiline-codec/273134/2 "2021-06-14T07:02:29Z")

</div>

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