sowawa / fluent-plugin-slack

132 stars 52 forks source link

escape special characters in message. #22

Closed fujiwara closed 8 years ago

fujiwara commented 8 years ago

I couldn't post message includes &token= via fluent-plugin-slack. See also https://api.slack.com/docs/formatting.

fluentd.conf

<source>
  type forward
</source>
<match slack.**>
  type slack
  webhook_url https://hooks.slack.com/services/xxxx/yyyyy
  channel sandbox
  message_keys message
  message "%s"
  flush_interval 1s
</match>

post an event to fluentd.

$ echo '{"message":"&token="}' | fluent-cat slack

Slack returns "Bad token" error.

2015-12-17 17:23:32 +0900 [info]: listening fluent socket on 0.0.0.0:24224
2015-12-17 17:23:34 +0900 [info]: out_slack: post_message {:channel=>"#sandbox", :text=>"&token=\n", :mrkdwn=>true, :link_names=>true}
2015-12-17 17:23:35 +0900 [error]: out_slack: error="res.code:404, res.body:Bad token, req_params:{:channel=>\"#sandbox\", :text=>\"&token=\\n\", :mrkdwn=>true, :link_names=>true}" error_class="Fluent::SlackClient::Error"
sonots commented 8 years ago

Thanks! I left comments.

sonots commented 8 years ago

Thanks!

sonots commented 8 years ago

0.6.2 is released!

sowawa commented 8 years ago

:star: