I'm trying to get message attributes, but the value is not returning...
input {
google_pubsub {
# Your GCP project id (name)
project_id => "dotz-dev-219021"
# The topic name below is currently hard-coded in the plugin. You
# must first create this topic by hand and ensure you are exporting
# logging to this pubsub topic.
topic => "dharma-monitoring"
# The subscription name is customizeable. The plugin will attempt to
# create the subscription (but use the hard-coded topic name above).
subscription => "logstash-sub"
# If you are running logstash within GCE, it will use
# Application Default Credentials and use GCE's metadata
# service to fetch tokens. However, if you are running logstash
# outside of GCE, you will need to specify the service account's
# JSON key file below.
json_key_file => "/usr/share/logstash/key.json"
# Should the plugin attempt to create the subscription on startup?
# This is not recommended for security reasons but may be useful in
# some cases.
create_subscription => true
codec => "json"
}
}
filter {
mutate {
add_field => { "serviceName" => "%{[@metadata][pubsub_message][attributes][serviceName]}" }
add_field => { "messageId" => "%{[@metadata][pubsub_message][messageId]}" }
}
}
I'm trying to get message attributes, but the value is not returning...
Returned values are:
Am I missing something ?