Hello Folks,
I've tried hacking at this for a while now so I thought I'd ask for some help, I have the following json in the message string associated with my input:
Ok just a couple of follow up questions, first of my logstash config looks slightly different:
bin/logstash -e 'input {
sqs {
queue=>"TestQueue"
}
}
filter {
mutate {
add_field => {
"metric-id" => "%{[1.0][metric-id]}"
}
}
}
output {
amazon_es {
hosts => ["someHost"]
region => "someRegion"
index => "myindex"
}
stdout {codec=>rubydebug } }'
Questions:
The major differences between your logstash config and mine is the fact that I am reading messages from an sqsqueueand the ordering of my filter versus yours ,do these differences matter?
What if I want to add the additional field called metric-id to my output elasticsearch index, is this the right way to go about that, its not clear from the documentation whether add_field will add a field to the actual output index
I still cannnot get metric-id to be printed correctly, in fact I get a value of "metric-id" => "%{[1.0][metric-id]}" in my ruby debug output
The source of the message doesn't matter as such. The ordering of filters matters but only in relation to each other. If e.g. filters or outputs are listed first doesn't matter.
Yes, you're on the right track. Except for subfields of @metadata all fields of an event propagate to outputs.
Yep, you got it. This is surprising since the default codec of the sqs input is json so at least I had a reasonable expectation that the messages read would be subject to JSON decoding. Perhaps this isn't working because the plugin stores the message payload in the Message field rather than message?
Exactly right, anyways on to the next adventure/hacking session with logstash filters
I have another contextual question is there a filter in logstash that acts as a datafeed to pull in data from various sources apply some business logic and dump the resulting aggregated data into elasticsearch, I have a feeling that I need to write something custom for this but wanted to check to see whats already existing?
I have another contextual question is there a filter in logstash that acts as a datafeed to pull in data from various sources apply some business logic and dump the resulting aggregated data into elasticsearch, I have a feeling that I need to write something custom for this but wanted to check to see whats already existing?
It's usually inputs that pull data from external sources, and there are obviously a lot of input plugins available. Your question is too broad for an answer, but in general Logstash acts on a per message basis so correlating data between different data sources or aggregating data typically requires custom code. It's not Logstash's strongest point.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.