ixixi / fluent-plugin-sqs

Store fluent-event as queue message to Amazon SQS.
35 stars 53 forks source link

Chore(lib/fluent/plugin/in_sqs.rb) Raw message #47

Open jamessantos10 opened 5 years ago

jamessantos10 commented 5 years ago

Adding the parameter raw_message, and enabling as true in my fluent.conf, I can see the raw message, if it is a json is shown json and if it is a string is shown the string. Example below that it worked correctly.

Before correction:

{"body":"{\n\n \"application\": \"teste-portuga\",\n   \"environment\": \"teste-portuga\"\n}\n","receipt_handle":"AQEBdqji/Q+s4h5byM74e3HDU6MsPLMshdxNbU0ZoxG70QlHzWnT1hY01wiyUafLwtz/4oQpaXVuWMnd2CbYwWzSEmltfdjxYIJcwTkGGPdR/PxWBbitUyN7x/RQfb7YxLLNYEy6tbZSVQOGRnk79bx19fx6qA3i8Lzl5wdRk7Xj4xhuHoKBaqZKpkVkA5gKZtf8izmxpmFph3cj+6UwR367EtVpK0Q/x6cGP5/ToYZxKEANRcxpvnHQMEnISu7//YsFcxeV/CN2mvSLIj0fFCv3UVfqpsbUVLS4dxDVHs9ypGewCrqX8j0yiBvMefnY/ovEc9iaTvwl/0tsubxaOWckn5w1tD5Mz1zpplOL/lue6O0LCh5yuf5ZSl9VYdj9t0GsmqHywSa8WtIogpG7cLnSGg==","message_id":"7556e466-97d5-4feb-a056-9410878a5746","md5_of_body":"3606fb98abe1341bd47cadea430381d2","queue_url":"https://sqs.sa-east-1.amazonaws.com/620282384849/teste-portuga","sender_id":""}

After correction:

{"application":"teste-portuga","environment":"teste-portuga"}

Obs: this is my fluent.conf:

 <source>
    @type sqs
    tag "portuga"
    sqs_url "teste"
    aws_key_id xxxxxx
    aws_sec_key xxxxxx
    region "region"
    raw_message true
    delete_message 
  </source>
  <match portuga>
    @type stdout
    <format>
      @type "json"
    </format>
  </match>