Skip to main content

Console

Forward

Synopsis

Creates a console target that writes log messages to the standard output. Supports field normalization to various logging standards through the field_format property.

Schema

- name: <string>
description: <string>
type: console
status: <boolean>
pipelines: <pipeline[]>
properties:
field_format: <string>
debug:
status: <boolean>
dont_send_logs: <boolean>

Configuration

The following are the fields used to define the target:

FieldRequiredDefaultDescription
nameYTarget name
descriptionN-Optional description
typeYMust be console
pipelinesN-Optional post-processor pipelines
statusNtrueEnable/disable the target
field_formatN-Data normalization format. See applicable Normalization section

Scheduling

See Scheduling and Pool Behavior for interval and cron fields shared by all targets.

Debug Options

FieldRequiredDefaultDescription
debug.statusNfalseEnable debug logging
debug.dont_send_logsNfalseProcess logs but don't send to target (testing)

Examples

Basic

Console use without field normalization:

targets:
- name: basic_console
type: console

ECS

Console use with ECS field normalization:

targets:
- name: ecs_console
type: console
properties:
field_format: "ecs"
note

For details of ECS, see Appendix.

ASIM

Console use with ASIM field normalization:

targets:
- name: asim_console
type: console
properties:
field_format: "asim"
tip

For details of ASIM, see Appendix.

Troubleshooting

This section covers the failures you are most likely to see with the console target. The target writes to the standard output of the Director process, so everything here turns on whether that stream is open and where it goes.

Where to look:

  • Director logs. Target errors are tagged with the target name and carry "Section":"SenderPool". The part after Reason: or after the last colon is the actual cause.
  • The target's connection status in the web interface. It shows the same reason as the log line, prefixed with connection failed for <target name>:.

See Target Delivery Errors for how Director logs and retries target failures.

"target broken" on a write to standard output

[Error] [director] [target-<target id>] [basic_console] Sender worker 2 execute() failed for <payload>: target broken: write /dev/stdout: <operating system error>

Cause: standard output is not writable. This happens when Director runs as a service with no console attached, or when its output is redirected to a pipe whose reader has already exited. The wording after the last colon is the operating system's own. It is typically The handle is invalid. or The pipe is being closed. on Windows, and typically broken pipe or bad file descriptor on Linux. Under systemd, standard output goes to the journal and works normally.

Fix: use this target where Director runs in a foreground terminal, or in a container whose log driver collects standard output. For a service installation, write to disk with the File target instead.

Data impact: nothing is lost. The batch is retried until it is written, and retrying cannot reopen a closed standard output, so the queue keeps growing until you change the configuration.

warning

Be careful when the output of Director is piped into another program. If the reading program exits first, the next write goes to a closed pipe, and a write to a closed pipe typically ends the writing process. Redirect the output to a file rather than piping it, keep the reader running for as long as Director runs, or use the file target for anything you need to keep.

Nothing is printed

Cause: debug.dont_send_logs is enabled. Records are processed by the pipeline and accepted, but nothing is written to standard output.

Fix: set debug.dont_send_logs: false. With debug.status also enabled, Director logs Log sending is disabled for this target (basic_console). Logs will be processed by the pipeline but will not be sent to the target. at startup, which confirms the mode.