TransWikia.com

Fluentd how to get source from a file by executing a script

Stack Overflow Asked by snoogybunny on December 27, 2021

I have a script called script.py. After running the script, I get different/various .log files in a folder. How do I write a config file which runs the script and then sends a log file successfully?

Here is my configuration which appears to be getting no output from match @type stdout:

<source>
  @type exec
  tag sensor_1.log-raw-data
  command python /home/cool/Desktop/script.py
  run_interval 5m
  <parse>
    keys something
  </parse>
</source>

<source>
  @type tail
  read_from_head true
  path /home/cool/Desktop/logs/0slaprunner.log
  tag foo.*
  <parse>
    @type none
  </parse>
</source>

<match pattern>
  @type stdout
</match>

One Answer

The argument for match section is pattern. It means that this would cater for the events with tag pattern. But, none of the tags in source sections is pattern; hence, no routing to stdout.

From your description, it looks like you want to route events from the tail input plugin to the stdout output plugin, so the relevant configuration would be something like this:

<source>
  @type tail
  # ...
  tag foo           # tag for the events
  # ...
</source>

<match foo>         # cater events with tag `foo`
  @type stdout
</match>

For debugging purposes, run fluentd with -v or -vv command-line option.

Answered by Azeem on December 27, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP