Skip to content

partial Env/Store Variables not expanded for plugins using Java Plugin API #11728

Open
@111andre111

Description

@111andre111

At the moment environment and secure store variables are not being expanded in partial strings before plugins developed using the Java Plugin API are initialized.

To replicate, first you will need to export an environment variable FOO (or add it to the truststore):

  export FOO=bar

started logstash at first with the old ruby world with message containing variable only:

#  bin\logstash --java-execution false -e 'input { generator { message => "${FOO}" count => 1} } output { stdout { codec => rubydebug } }'
{
      "sequence" => 0,
          "host" => "COMPUTER",
       "message" => "bar",
    "@timestamp" => 2020-03-27T17:09:20.446Z,
      "@version" => "1"
}

--> ok

And now a message with message containing variable as a part:

# bin\logstash --java-execution false -e 'input { generator { message => "${FOO}sage" count => 1} } output { stdout { codec => rubydebug } }'
{
      "sequence" => 0,
          "host" => "COMPUTER",
       "message" => "barsage",
    "@timestamp" => 2020-03-27T17:09:21.784Z,
      "@version" => "1"
}

--> ok

Then the same for the Java Plugin world with message containing variable only:

  bin\logstash --java-execution true -e 'input { java_generator { message => "${FOO}" count => 1} } output { stdout { codec => rubydebug } }'
{
    "thread_number" => 0,
       "@timestamp" => 2020-03-27T17:10:44.431Z,
          "message" => "bar",
         "sequence" => 0,
         "hostname" => "COMPUTER",
         "@version" => "1"
}

ok -> solved in #10973 -> #11043

And again with message containing variable as a part:

  bin\logstash --java-execution true -e 'input { java_generator { message => "${FOO}sage" count => 1} } output { stdout { codec => rubydebug } }'
{
          "message" => "${FOO}sage",
         "sequence" => 0,
         "@version" => "1",
       "@timestamp" => 2020-03-27T17:11:47.759Z,
    "thread_number" => 0,
         "hostname" => "COMPUTER"
}
-->  nok
This last part doesn't seem to work.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions