[[file-output]]
=== Configure the File output

++++
<titleabbrev>File</titleabbrev>
++++

The File output dumps the transactions into a file where each transaction is in a JSON format.
Currently, this output is used for testing, but it can be used as input for
Logstash.

["source","yaml",subs="attributes"]
------------------------------------------------------------------------------
output.file:
  path: "/tmp/{beatname_lc}"
  filename: {beatname_lc}
  #rotate_every_kb: 10000
  #number_of_files: 7
  #permissions: 0600
------------------------------------------------------------------------------

==== Configuration options

You can specify the following options in the `file` section of the +{beatname_lc}.yml+ config file:

===== `enabled`

The enabled config is a boolean setting to enable or disable the output. If set
to false, the output is disabled.

The default value is true.

[[path]]
===== `path`

The path to the directory where the generated files will be saved. This option is
mandatory.

===== `filename`

The name of the generated files. The default is set to the Beat name. For example, the files
generated by default for {beatname_uc} would be "{beatname_lc}", "{beatname_lc}.1", "{beatname_lc}.2", and so on.

===== `rotate_every_kb`

The maximum size in kilobytes of each file. When this size is reached, the files are
rotated. The default value is 10240 KB.

===== `number_of_files`

The maximum number of files to save under <<path,`path`>>. When this number of files is reached, the
oldest file is deleted, and the rest of the files are shifted from last to first.
The number of files must be between 2 and 1024. The default is 7.

===== `permissions`

Permissions to use for file creation. The default is 0600.

===== `codec`

Output codec configuration. If the `codec` section is missing, events will be json encoded.

See <<configuration-output-codec>> for more information.
