Skip to content

Cannot reference a field inside string #25

Closed
@ozturkberkay

Description

@ozturkberkay

Hi,

I'm trying to reference a configuration field from a string inside message_properties. Instead of the field value, what I get is the literal representation of the string; in this case: %{myfield}.

  • Version: Logstash 7.4.2
  • Operating System: Windows Server 2016 Standard (1607)
  • Config File:
input {
    tcp {
        ...
    }
}

filter {
    if [somefield] == "something" {
        ...
        split {
	    field => "somefield2"
	}
	csv {
	    columns => [ "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "c10", "c11" ]
	    separator => ","
	}
        if [c11] =~ someregex {
            ...
            mutate {
                rename => { "somefield3" => "myfield" }
            }
           ...
        } else {
            drop {}
        }

    }

}

output {
    if "_jsonparsefailure" in [tags] {
        ...
    } else {
        ...
        rabbitmq {
            ...
            message_properties => {
              "content_type" => "application/json"
              "priority" => 1
              "app_id" => "%{myfield}"
            }
            ...
        }
    }
}
  • Sample Data:
{"somefield": "something", "somefield2":"field1,field2,field3,field4,field5,field6,field7,field8,field9,field10,field11", "somefield3": "something"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions