# Parsing whole file as a single event

**URL:** <https://discuss.elastic.co/t/parsing-whole-file-as-a-single-event/249317>\
**Category:** Logstash\
**Created:** [September 21, 2020, 7:59am UTC](https://discuss.elastic.co/t/parsing-whole-file-as-a-single-event/249317 "2020-09-21T07:59:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![thdesy](https://avatars.discourse-cdn.com/v4/letter/t/71e660/32.png) [@thdesy](https://discuss.elastic.co/u/thdesy)\
**Post date:** [September 21, 2020, 7:59am UTC](https://discuss.elastic.co/t/parsing-whole-file-as-a-single-event/249317/1 "2020-09-21T07:59:13Z")

</div>

Hi all,

I would like to monitor a directory, where per event a file is written; each event-file consists of several key=value pairs.

```auto
> /var/log/dir/history.*
> head /var/log/dir/history.1234
     key1 = value1
     key2 = value2
     ...

```

I put the kv filter plugin on the files and in principle it parses the key-value pairs. But I have not managed to read the input as some kind of multiline, i.e., I need to conflate each file into one event.

Since the multiline input requires a pattern to match as go forward/backward from the match, I am not sure how to formulate a a rule for the "whole" file (since the regexp needs some character pattern, or?).  
Because I have to consider the whole file as one event, I have no real regex or so to match.

Is there maybe something else than multiline or so, that I can use as input plugin (or tell multiline to match on fopen/fclose? 😉 )

Cheers and thanks for any ideas,  
Thomas

---

<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:** [September 21, 2020, 1:59pm UTC](https://discuss.elastic.co/t/parsing-whole-file-as-a-single-event/249317/2 "2020-09-21T13:59:57Z")

</div>

Answered [here](https://discuss.elastic.co/t/log-file-parsing-and-ingesting-into-es/247806/7).

---

<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:** [October 19, 2020, 2:00pm UTC](https://discuss.elastic.co/t/parsing-whole-file-as-a-single-event/249317/3 "2020-10-19T14:00:06Z")

</div>

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