Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Add keystore support for autodiscover static configurations. {pull]16306[16306]
- Add TLS support to Kerberos authentication in Elasticsearch. {pull}18607[18607]
- Add support for multiple sets of hints on autodiscover {pull}18883[18883]
- Add config option `rotate_on_startup` to file output {issue}19150[19150] {pull}19347[19347]
- Add a configurable delay between retries when an app metadata cannot be retrieved by `add_cloudfoundry_metadata`. {pull}19181[19181]
- Added the `max_cached_sessions` option to the script processor. {pull}19562[19562]
- Add support for DNS over TLS for the dns_processor. {pull}19321[19321]
Expand Down
20 changes: 11 additions & 9 deletions libbeat/outputs/fileout/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,21 @@ import (
)

type config struct {
Path string `config:"path"`
Filename string `config:"filename"`
RotateEveryKb uint `config:"rotate_every_kb" validate:"min=1"`
NumberOfFiles uint `config:"number_of_files"`
Codec codec.Config `config:"codec"`
Permissions uint32 `config:"permissions"`
Path string `config:"path"`
Filename string `config:"filename"`
RotateEveryKb uint `config:"rotate_every_kb" validate:"min=1"`
NumberOfFiles uint `config:"number_of_files"`
Codec codec.Config `config:"codec"`
Permissions uint32 `config:"permissions"`
RotateOnStartup bool `config:"rotate_on_startup"`
}

var (
defaultConfig = config{
NumberOfFiles: 7,
RotateEveryKb: 10 * 1024,
Permissions: 0600,
NumberOfFiles: 7,
RotateEveryKb: 10 * 1024,
Permissions: 0600,
RotateOnStartup: true,
}
)

Expand Down
5 changes: 5 additions & 0 deletions libbeat/outputs/fileout/docs/fileout.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ output.file:
#rotate_every_kb: 10000
#number_of_files: 7
#permissions: 0600
#rotate_on_startup: true
------------------------------------------------------------------------------

==== Configuration options
Expand Down Expand Up @@ -61,6 +62,10 @@ The number of files must be between 2 and 1024. The default is 7.

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

===== `rotate_on_startup`

If the output file already exists on startup, immediately rotate it and start writing to a new file instead of appending to the existing one. Defaults to true.

===== `codec`

Output codec configuration. If the `codec` section is missing, events will be json encoded.
Expand Down
1 change: 1 addition & 0 deletions libbeat/outputs/fileout/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ func (out *fileOutput) init(beat beat.Info, c config) error {
file.MaxSizeBytes(c.RotateEveryKb*1024),
file.MaxBackups(c.NumberOfFiles),
file.Permissions(os.FileMode(c.Permissions)),
file.RotateOnStartup(c.RotateOnStartup),
file.WithLogger(logp.NewLogger("rotator").With(logp.Namespace("rotator"))),
)
if err != nil {
Expand Down