# How to configure filebeat to send multiline logs only after the log file is finished updating?

**URL:** https://discuss.elastic.co/t/how-to-configure-filebeat-to-send-multiline-logs-only-after-the-log-file-is-finished-updating/120088
**Category:** Beats
**Tags:** filebeat
**Created:** [February 15, 2018, 11:47pm UTC](https://discuss.elastic.co/t/how-to-configure-filebeat-to-send-multiline-logs-only-after-the-log-file-is-finished-updating/120088 "2018-02-15T23:47:35Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![saikrishnagaddipati](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@saikrishnagaddipati](https://discuss.elastic.co/u/saikrishnagaddipati)
#### Post date: [February 15, 2018, 11:47pm UTC](https://discuss.elastic.co/t/how-to-configure-filebeat-to-send-multiline-logs-only-after-the-log-file-is-finished-updating/120088/1 "2018-02-15T23:47:35Z")

</div>

I am using filebeat-5.6  
My config filebeat -\> logstash -\> elasticsearch -\> kibana

I have hundreds of log files with 1KB - 2KB data in the path "c:\programdata\AICdameon\ "  
All the files get created when the background jobs start's and the files get updated at regular intervals.  
How to make file beat send the whole log file as a single message to elasticsearch **only when the log file is finished updating??**.  
All log file's start with the line "starting jobid 247HQD51" and ends with the line "end job 247HQD51".  
My below filebeat config is not working as expected, my filebeat sends logs as soon as they get updated in the log file.  
---  
filebeat:  
prospectors:  
- input\_type: log  
paths:  
- c:\programdata\AICdameon\*  
fields:  
type: backupHQD  
fields\_under\_root: true  
multiline.pattern: '\*'  
multiline.negate: true  
multiline.match: after

---

<div class="post-metadata">

### Author: ![kvch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kvch/32/72058_2.png) [@kvch](https://discuss.elastic.co/u/kvch)
#### Post date: [February 16, 2018, 1:06pm UTC](https://discuss.elastic.co/t/how-to-configure-filebeat-to-send-multiline-logs-only-after-the-log-file-is-finished-updating/120088/2 "2018-02-16T13:06:47Z")

</div>

You could use the following multiline config:

```auto
multiline.pattern: "^end job [0-9A-Z]+$"
multiline.negate: true
multiline.match: "before"

```

Thus, the whole file will be in one event.  
Please note, if your log file it too big, it might lead to too big resource consumption or your Beat might run out of memory.

---

<div class="post-metadata">

### Author: ![saikrishnagaddipati](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@saikrishnagaddipati](https://discuss.elastic.co/u/saikrishnagaddipati)
#### Post date: [February 16, 2018, 4:48pm UTC](https://discuss.elastic.co/t/how-to-configure-filebeat-to-send-multiline-logs-only-after-the-log-file-is-finished-updating/120088/3 "2018-02-16T16:48:54Z")

</div>

Hi kvch, @kvch I tried your config but i can see each line in the log file getting populated into seperate document's in kibana  
Below is my log file with 9 lines  
starting jobid 247HQD51  
Status 83  
LOG 1517035863 4 sgtm 15937 Backup started  
LOG 1517035863 4 sgtm 2788 start  
LOG 1517035863 4 sgtm 2788 using 262144 data buffer size  
LOG 1517035863 4 sgtm 2788 setting receive network buffer to 1049600 bytes  
LOG 1517035863 4 sgtm 2788 using 30 data buffers  
LOG 1517036526 32 sgtm 2788 sts\_get\_server\_prop\_byname failed: error 2060046 plugin error  
end job 247HQD51

when the file gets populated with first 5 lines in first 2 minutes then am seeing these five log messages in five different documents in elastisearch(but i am trying to get the whole log file as a single message depending on the last line) and in the next 2 minutes when the log file gets populated with remianing 4 lines i am seeing the next 4 lines getting populated into a single 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: [March 16, 2018, 4:48pm UTC](https://discuss.elastic.co/t/how-to-configure-filebeat-to-send-multiline-logs-only-after-the-log-file-is-finished-updating/120088/4 "2018-03-16T16:48:58Z")

</div>

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