Skip to content

Output to Log file changes the destination of stdout output plugin too #5029

@aggarwalShivani

Description

@aggarwalShivani

Describe the bug

Requirement:
Fluentd runs as a kubernetes container
i.) Fluentd's own logs should be redirected to a log file
ii.) Fluentd is expected to read some other data from other plugins like in_http and emit that data onto stdout.

Issue:
To achieve (i.), -o command-line option is used as suggested at https://docs.fluentd.org/deployment/logging#by-command-line-option-1

$ fluentd -o /var/log/fluentd.log

To achieve (ii.), a match with stdout output plugin is added in the config.
For ex.

<source>
  @type http
  port 9880
  bind 0.0.0.0
  tag test
</source>

<match test>
    @type stdout
 </match>

If we configure fluentd process to output to a log-file, it also redirects the data (tagged test) intended for stdout, into the /var/log/fluentd.log file. It does not emit anything on stdou anymore.

Is this expected?

How to avoid it such that the log location and stdout location are separate?

To Reproduce

  1. Configure fluentd config (as shared above)
  2. Start fluentd with -o option
    fluentd -o /var/log/fluentd.log
  3. Send data on the http input. For ex
    curl -X POST -d 'json={"foo":"bar"}' http://localhost:9880/test

Expected behavior

Fluentd own logs must go to logfile.
Records read from http must be present on stdout of fluentd

Your Environment

- Fluentd version: 1.16.9
- Package version:5.0.7
- Operating system: Rocky Linux 8.10
- Kernel version:6.6.87.2-microsoft-standard-WSL2

Your Configuration

<source>
  @type http
  port 9880
  bind 0.0.0.0
  tag test
</source>

<match test>
    @type stdout
 </match>

Your Error Log

No error log, there is no data emitted on stdout of fluentd container.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementFeature request or improve operations

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions