Logstash to cloudwatch


I am trying to push metrics from Logstash to Cloudwatch, I am using the cloudwatch output plugin.
Below is the config.
input {
beats {
port => 5044

filter {

match=> {"message"=>"%{IP:clientip} [%{NOTSPACE:date} +%{INT}] %{NOTSPACE:loglevel} %{NOTSPACE:id} "%{WORD:method} %{NOTSPACE:request} %{WORD:protocol}/%{NUMBER:protocolversion}" %{NUMBER:status} %{NUMBER:inputsize} %{NUMBER:bytesent} %{QUOTEDSTRING:referrer} "%{NOTSPACE:useragent}" %{NUMBER:responsetime} %{NUMBER:executiontime}"

output {
cloudwatch {
metricname => "input_size_metric"
access_key_id => "access_key_id"
secret_access_key => "secret_access_key"
region => "region"
dimensions => [ "Metric_Name", "metric_inp_bytes" ]
unit => "Bytes"
value => [inputsize]

file {
path => "~/test_logstash_file_output.txt"
codec => line { format => "custom format: %{[clientip]} | %{[inputsize]} - %{message}"}

In CloudWatch the event shows up but not with the size value that was sent from logstash its at the X axis of 0, whereas in the test output file it does show up the correct value of inputsize.

To troubleshoot it I also tried Count as unit for the status field and it does similar.

I looked at the documentation https://www.elastic.co/guide/en/logstash/current/plugins-outputs-cloudwatch.html but that did not help me.

Any pointers appreciated.


Corrected the config value => "%{[inputsize]}" and it started to work.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.