Skip to main content
Version: 3.3.1

file

Write to a file

Can use field expansions to create the filename. When it changes, you can specify a header and/or footer

Example

action:

file:
path: '/tmp/out-${now_time_fmt %Y-%M-%D}.log
input-field: out
header: Start: ${name}

Field NameDescriptionTypeDefault
batchMaximum number of events in an output batch. If 'document' send on end of documentinteger or the 'document'-
timeoutInterval after which the batch is sent, to keep throughput goinginterval100ms
headerPut a header line before the batchtemplated text-
footerPut a header line after the last line of the batchtemplated text-
use-document-markerEnrich the pipe metadata with a document marker (for document handling in batch mode)boolfalse
retryFor operations that could potentially failRetry-
pathPath to the file to be writtenstring-
input-fieldUse the specified field as the content for the file linefield-
flush-at-endWhen the filename changes a new file will be written, force a flush at that pointboolfalse
compress-afterCompress the written file after the filename changesboolfalse
create-directoriesCreate parent directories for the given path if they do not existboolfalse

batch

Maximum number of events in an output batch. If 'document' send on end of document

Type: integer or the 'document'

timeout

Interval after which the batch is sent, to keep throughput going

Type: interval

Put a header line before the batch

Type: templated text

Put a header line after the last line of the batch

Type: templated text

use-document-marker

Enrich the pipe metadata with a document marker (for document handling in batch mode)

Type: bool

retry

For operations that could potentially fail

Type: Retry

Field NameDescriptionTypeDefault
countHow many attempts to make before declaring failureinteger-
pauseHow long to pause before re-tryingduration-
foreverKeep trying until success is declaredboolfalse

count

How many attempts to make before declaring failure

Type: integer

Example

action:

exec:
command: echo 'one two'
retry:
count: 1

output:

{"_raw":"one two"}

pause

How long to pause before re-trying

Accepts human-friendly formats, like 1m (for 1 minute) and 4h (for 4 hours)

Type: duration

Example

action:

exec:
command: echo 'one two'
retry:
count: 6
pause: 10s

output:

{"_raw":"one two"}

forever

Keep trying until success is declared

Accepts human-friendly formats, like 1m (for 1 minute) and 4h (for 4 hours)

Type: bool

Example

action:

exec:
command: echo 'one two'
retry:
forever: true

output:

{"_raw":"one two"}

path

Path to the file to be written

Type: string

input-field

Use the specified field as the content for the file line

Type: field

flush-at-end

When the filename changes a new file will be written, force a flush at that point

Type: bool

compress-after

Compress the written file after the filename changes

Type: bool

create-directories

Create parent directories for the given path if they do not exist

Type: bool