# Placing Mutliline file into 1 document

**URL:** <https://discuss.elastic.co/t/placing-mutliline-file-into-1-document/170983>\
**Category:** Logstash\
**Created:** [March 5, 2019, 8:00pm UTC](https://discuss.elastic.co/t/placing-mutliline-file-into-1-document/170983 "2019-03-05T20:00:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Elk\_huh](https://avatars.discourse-cdn.com/v4/letter/e/d26b3c/32.png) [@Elk\_huh](https://discuss.elastic.co/u/Elk_huh)\
**Post date:** [March 5, 2019, 8:00pm UTC](https://discuss.elastic.co/t/placing-mutliline-file-into-1-document/170983/1 "2019-03-05T20:00:02Z")

</div>

I have a file that looks like this and I keep getting the first 7 lines as individual documents and the last one its own document. How do i get it so all of these come back as 1 document

## I have so far

## filter{ kv {} }

input file

startTime:34534  
accountId:78  
format:CEF  
checksum:grtgt45hfgh  
endTime:45645645  
configId:1234  
|==|  
CEF=0 helloworld=234 32313 name=ob age=90

---

<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:** [March 5, 2019, 8:31pm UTC](https://discuss.elastic.co/t/placing-mutliline-file-into-1-document/170983/2 "2019-03-05T20:31:58Z")

</div>

What input are you using?

---

<div class="post-metadata">

**Author:** ![Elk\_huh](https://avatars.discourse-cdn.com/v4/letter/e/d26b3c/32.png) [@Elk\_huh](https://discuss.elastic.co/u/Elk_huh)\
**Post date:** [March 5, 2019, 8:57pm UTC](https://discuss.elastic.co/t/placing-mutliline-file-into-1-document/170983/3 "2019-03-05T20:57:40Z")

</div>

input {  
file {  
path =\> "/tmp/logs/\*.log"  
codec =\> multiline {  
pattern =\> "^CEF"  
negate =\> true  
what =\> "previous"  
}  
}

---

<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:** [March 5, 2019, 9:32pm UTC](https://discuss.elastic.co/t/placing-mutliline-file-into-1-document/170983/4 "2019-03-05T21:32:23Z")

</div>

OK, so the codec is looking for any lines that match ^CEF. Lines that do not match are joined to the previous event. A line that matches CEF starts a new event.

If you want to consume the entire file as a single event then use a pattern that never matches and flush using a timeout

```
codec => multiline {
    pattern => "^Spalanzani"
    what => "previous" 
    negate => true 
    auto_flush_interval => 2
}

```

If you have a repeating pattern of lines you also have the option of

```
codec => multiline {
    pattern => "^CEF"
    what => "next" 
    negate => true 
    auto_flush_interval => 2
}
```

---

<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 2, 2019, 9:32pm UTC](https://discuss.elastic.co/t/placing-mutliline-file-into-1-document/170983/5 "2019-04-02T21:32:27Z")

</div>

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