# Output file adding static opening/closing line

**URL:** <https://discuss.elastic.co/t/output-file-adding-static-opening-closing-line/163695>\
**Category:** Logstash\
**Created:** [January 10, 2019, 9:45am UTC](https://discuss.elastic.co/t/output-file-adding-static-opening-closing-line/163695 "2019-01-10T09:45:59Z")\
**Posts on this page:** 4\
**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:** [January 10, 2019, 9:45am UTC](https://discuss.elastic.co/t/output-file-adding-static-opening-closing-line/163695/1 "2019-01-10T09:45:59Z")

</div>

Hi all,

probably a pretty newbie question, but I would like to add to output files automatically a static opening and closing line.

I.e., I would like to split on a daily basis an output file [1] where I have individual json objects per line

> L1 {...}  
> L2 {...}  
> L3 {...}  
> ...

where the closed file is obviously no proper JSON itself, so I would like to add an opener/header (and list commas)

> L0 [  
> L1 {...} ,  
> L2 {...} ,  
> L3 {...} ,  
> ...  
> LE ]

but how should a filter(?) look like to add such an opening/closing line per daily rotated file?

Cheers and thanks for ideas,  
Thomas

[1]

> output {  
> file {  
> ...  
> path =\> "/my.out/path/name-%{+YYYYMMDD}.txt"  
> }  
> }

---

<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:** [January 10, 2019, 2:53pm UTC](https://discuss.elastic.co/t/output-file-adding-static-opening-closing-line/163695/2 "2019-01-10T14:53:35Z")

</div>

I cannot think of a way of doing that. (And I know that doesn't help, but at least you know you are not being completely ignored.)

---

<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:** [January 11, 2019, 9:18am UTC](https://discuss.elastic.co/t/output-file-adding-static-opening-closing-line/163695/3 "2019-01-11T09:18:31Z")

</div>

OK - thanks for the feedback  
it helps - at least I know not to spend much more time on it and feel not too stupid 😅

---

<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:** [February 8, 2019, 9:18am UTC](https://discuss.elastic.co/t/output-file-adding-static-opening-closing-line/163695/4 "2019-02-08T09:18:36Z")

</div>

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