|
| 1 | +:plugin: file |
| 2 | +:type: output |
| 3 | + |
| 4 | +/////////////////////////////////////////// |
| 5 | +START - GENERATED VARIABLES, DO NOT EDIT! |
| 6 | +/////////////////////////////////////////// |
| 7 | +:version: %VERSION% |
| 8 | +:release_date: %RELEASE_DATE% |
| 9 | +:changelog_url: %CHANGELOG_URL% |
| 10 | +:include_path: ../../../logstash/docs/include |
| 11 | +/////////////////////////////////////////// |
| 12 | +END - GENERATED VARIABLES, DO NOT EDIT! |
| 13 | +/////////////////////////////////////////// |
| 14 | + |
| 15 | +[id="plugins-{type}-{plugin}"] |
| 16 | + |
| 17 | +=== File |
| 18 | + |
| 19 | +include::{include_path}/plugin_header.asciidoc[] |
| 20 | + |
| 21 | +==== Description |
| 22 | + |
| 23 | +This output writes events to files on disk. You can use fields |
| 24 | +from the event as parts of the filename and/or path. |
| 25 | + |
| 26 | +By default, this output writes one event per line in **json** format. |
| 27 | +You can customise the line format using the `line` codec like |
| 28 | +[source,ruby] |
| 29 | +output { |
| 30 | + file { |
| 31 | + path => ... |
| 32 | + codec => line { format => "custom format: %{message}"} |
| 33 | + } |
| 34 | +} |
| 35 | + |
| 36 | +[id="plugins-{type}s-{plugin}-options"] |
| 37 | +==== File Output Configuration Options |
| 38 | + |
| 39 | +This plugin supports the following configuration options plus the <<plugins-{type}s-common-options>> described later. |
| 40 | + |
| 41 | +[cols="<,<,<",options="header",] |
| 42 | +|======================================================================= |
| 43 | +|Setting |Input type|Required |
| 44 | +| <<plugins-{type}s-{plugin}-create_if_deleted>> |<<boolean,boolean>>|No |
| 45 | +| <<plugins-{type}s-{plugin}-dir_mode>> |<<number,number>>|No |
| 46 | +| <<plugins-{type}s-{plugin}-file_mode>> |<<number,number>>|No |
| 47 | +| <<plugins-{type}s-{plugin}-filename_failure>> |<<string,string>>|No |
| 48 | +| <<plugins-{type}s-{plugin}-flush_interval>> |<<number,number>>|No |
| 49 | +| <<plugins-{type}s-{plugin}-gzip>> |<<boolean,boolean>>|No |
| 50 | +| <<plugins-{type}s-{plugin}-path>> |<<string,string>>|Yes |
| 51 | +|======================================================================= |
| 52 | + |
| 53 | +Also see <<plugins-{type}s-common-options>> for a list of options supported by all |
| 54 | +output plugins. |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | +[id="plugins-{type}s-{plugin}-create_if_deleted"] |
| 59 | +===== `create_if_deleted` |
| 60 | + |
| 61 | + * Value type is <<boolean,boolean>> |
| 62 | + * Default value is `true` |
| 63 | + |
| 64 | +If the configured file is deleted, but an event is handled by the plugin, |
| 65 | +the plugin will recreate the file. Default => true |
| 66 | + |
| 67 | +[id="plugins-{type}s-{plugin}-dir_mode"] |
| 68 | +===== `dir_mode` |
| 69 | + |
| 70 | + * Value type is <<number,number>> |
| 71 | + * Default value is `-1` |
| 72 | + |
| 73 | +Dir access mode to use. Note that due to the bug in jruby system umask |
| 74 | +is ignored on linux: https://github.com/jruby/jruby/issues/3426 |
| 75 | +Setting it to -1 uses default OS value. |
| 76 | +Example: `"dir_mode" => 0750` |
| 77 | + |
| 78 | +[id="plugins-{type}s-{plugin}-file_mode"] |
| 79 | +===== `file_mode` |
| 80 | + |
| 81 | + * Value type is <<number,number>> |
| 82 | + * Default value is `-1` |
| 83 | + |
| 84 | +File access mode to use. Note that due to the bug in jruby system umask |
| 85 | +is ignored on linux: https://github.com/jruby/jruby/issues/3426 |
| 86 | +Setting it to -1 uses default OS value. |
| 87 | +Example: `"file_mode" => 0640` |
| 88 | + |
| 89 | +[id="plugins-{type}s-{plugin}-filename_failure"] |
| 90 | +===== `filename_failure` |
| 91 | + |
| 92 | + * Value type is <<string,string>> |
| 93 | + * Default value is `"_filepath_failures"` |
| 94 | + |
| 95 | +If the generated path is invalid, the events will be saved |
| 96 | +into this file and inside the defined path. |
| 97 | + |
| 98 | +[id="plugins-{type}s-{plugin}-flush_interval"] |
| 99 | +===== `flush_interval` |
| 100 | + |
| 101 | + * Value type is <<number,number>> |
| 102 | + * Default value is `2` |
| 103 | + |
| 104 | +Flush interval (in seconds) for flushing writes to log files. |
| 105 | +0 will flush on every message. |
| 106 | + |
| 107 | +[id="plugins-{type}s-{plugin}-gzip"] |
| 108 | +===== `gzip` |
| 109 | + |
| 110 | + * Value type is <<boolean,boolean>> |
| 111 | + * Default value is `false` |
| 112 | + |
| 113 | +Gzip the output stream before writing to disk. |
| 114 | + |
| 115 | +[id="plugins-{type}s-{plugin}-path"] |
| 116 | +===== `path` |
| 117 | + |
| 118 | + * This is a required setting. |
| 119 | + * Value type is <<string,string>> |
| 120 | + * There is no default value for this setting. |
| 121 | + |
| 122 | +The path to the file to write. Event fields can be used here, |
| 123 | +like `/var/log/logstash/%{host}/%{application}` |
| 124 | +One may also utilize the path option for date-based log |
| 125 | +rotation via the joda time format. This will use the event |
| 126 | +timestamp. |
| 127 | +E.g.: `path => "./test-%{+YYYY-MM-dd}.txt"` to create |
| 128 | +`./test-2013-05-29.txt` |
| 129 | + |
| 130 | +If you use an absolute path you cannot start with a dynamic string. |
| 131 | +E.g: `/%{myfield}/`, `/test-%{myfield}/` are not valid paths |
| 132 | + |
| 133 | + |
| 134 | + |
| 135 | +include::{include_path}/{type}.asciidoc[] |
0 commit comments