javabashexecfluentdtd-agent

Launch java command from in_exec Fluentd plugin


I have any problems to configure Fluentd; I want call in_exec plugin to launch Linux bash script that call a jar but it doesn't work. My code:

  <source>
    @type exec
    format none
    tag none
    command sh /var/tmp/script.sh
    run_interval 5m
  </source>

And my script is:

  #!/bin/bash
  java -jar example.jar

I don't understad where I wrong; if I change script (for example to create a file) all it's OK but if I use java command it doesn't work.

Please help me! Thanks


Solution

  • Try to update your script with the absolute path to the jar in the sh file. Otherwise, there may be a problem when executing script in different locations and it will fail to find the jar.

      #!/bin/bash
      java -jar /hom/{User}/{Path to Jar}example.jar