# how to append to file?

**URL:** <https://community.zeek.org/t/how-to-append-to-file/1427>\
**Category:** Zeek\
**Created:** [October 29, 2008, 11:49am UTC](https://community.zeek.org/t/how-to-append-to-file/1427 "2008-10-29T11:49:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hossein\_talebi](https://avatars.discourse-cdn.com/v4/letter/h/f17d59/32.png) [@hossein\_talebi](https://community.zeek.org/u/hossein_talebi)\
**Post date:** [October 29, 2008, 11:49am UTC](https://community.zeek.org/t/how-to-append-to-file/1427/1 "2008-10-29T11:49:40Z")

</div>

Hi

i have write scripts (inside a policy)  
i have write following line :  
“global result\_file = open\_log\_file(“result\_file”)”  
this led to create a new file with result\_file in current directory  
i want to run my policy to multi file and put output per file in “result\_file”  
but while i run my policy are create new file and overwrite to old “result\_file”

how to append output to old “result\_file” without create new file(overwrite)

---

<div class="post-metadata">

**Author:** ![Vern](https://yyz1.discourse-cdn.com/flex011/user_avatar/community.zeek.org/vern/32/630_2.png) [@Vern](https://community.zeek.org/u/Vern)\
**Post date:** [October 29, 2008, 2:25pm UTC](https://community.zeek.org/t/how-to-append-to-file/1427/2 "2008-10-29T14:25:00Z")

</div>

There's a built-in function open\_for\_append().

&nbsp;&nbsp;&nbsp;&nbsp;Vern

---

<div class="post-metadata">

**Author:** ![Seth\_Hall](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@Seth\_Hall](https://community.zeek.org/u/Seth_Hall)\
**Post date:** [October 29, 2008, 2:29pm UTC](https://community.zeek.org/t/how-to-append-to-file/1427/3 "2008-10-29T14:29:27Z")

</div>

> i have write scripts (inside a policy)  
> i have write following line :  
> "global result\_file = open\_log\_file("result\_file")"  
> this led to create a new file with result\_file in current directory  
> i want to run my policy to multi file and put output per file in "result\_file"  
> but while i run my policy are create new file and overwrite to old "result\_file"

I'm not sure what you're asking here.

> how to append output to old "result\_file" without create new file(overwrite)

You can make appending the default behavior for all of your log files by loading the "log-append" script.

&nbsp;&nbsp;&nbsp;.Seth

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/zeek/original/1X/f09d732bc2cc7c7cc7e35db67cf4e1d5233ce7a7.png) [@system](https://community.zeek.org/u/system)\
**Post date:** [May 6, 2022, 3:38pm UTC](https://community.zeek.org/t/how-to-append-to-file/1427/4 "2022-05-06T15:38:44Z")

</div>


