# Filter for multi-lines PostgreSQL log

**URL:** <https://discuss.elastic.co/t/filter-for-multi-lines-postgresql-log/123657>\
**Category:** Logstash\
**Created:** [March 13, 2018, 12:40am UTC](https://discuss.elastic.co/t/filter-for-multi-lines-postgresql-log/123657 "2018-03-13T00:40:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luiz\_Siqueira](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luiz_siqueira/32/28692_2.png) [@Luiz\_Siqueira](https://discuss.elastic.co/u/Luiz_Siqueira)\
**Post date:** [March 13, 2018, 12:40am UTC](https://discuss.elastic.co/t/filter-for-multi-lines-postgresql-log/123657/1 "2018-03-13T00:40:01Z")

</div>

Hello, great!  
I really need your help.

I need to merge the lines of the same PostgreSQL event. My "/var/log/postgresql/postgresql-9.5-main.log" events are as follows:

> 2018-03-12 20:14:54 AMT [11143]: [1-1] LOG: connection received: host = 192.168.0.100 port = 45045  
> 2018-03-12 20:14:54 AMT [11143]: [2-1] LOG: authorized connection: user = portalsetorial database = portal\_setorial SSL enabled (protocol = TLSv1.2, cipher = ECDHE-RSA-AES256- GCM-SHA384, compression = enabled)  
> 2018-03-12 20:14:54 AMT [11143]: [3-1] ERROR: missing entry for table "session" in clause FROM in character 10  
> 2018-03-12 20:14:54 AMT [11143]: [4-1] COMMAND: SELECT @@ SESSION.sql\_mode  
> 2018-03-12 20:15:00 AMT [11143]: [5-1] LOG: disconnect: Session time: 0: 00: 05 817 user = portalsetorial database = portal\_setorial machine = 192.168.0.100 port = 45045

I want, for example, that all events of id "11143" be sent to the "message" field, so that I can relate them correctly through Kibaba filters.

Today my file "logstash.yml" looks like this:

> input {  
> file {  
> path =\> ["/var/log/postgresql/\*.log"]  
> type =\> "all"  
> }  
> }  
> output {  
> elasticsearch { hosts =\> ["192.168.0.67:9200"] }  
> stdout { codec =\> rubydebug }  
> }

How should I do?  
Any help is very welcome. Thank you!

---

<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:** [April 10, 2018, 12:40am UTC](https://discuss.elastic.co/t/filter-for-multi-lines-postgresql-log/123657/2 "2018-04-10T00:40:04Z")

</div>

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