'SNS'에 해당되는 글 1건

  1. 2018.07.09 [Logstash] http output plugin - slack chat

[Logstash] http output plugin - slack chat

Elastic/Logstash 2018. 7. 9. 12:19


예전에는 output slack_chat 이라고 플러그인을 만들어서 사용을 했었는데 logstash output http 가 있어서 그냥 이걸로 바로 사용하겠습니다.


공식문서에 잘못된 정보가 있기 때문에 그대로 보고 따라 하시면 시간을 낭비 하실 수 있습니다.

(6.3.0 에서 테스트 되었습니다.)


Reference)

https://www.elastic.co/guide/en/logstash/current/plugins-outputs-http.html


input {

stdin {}

}


output {

stdout { codec => rubydebug }

http {

url => "https://slack.com/api/chat.postMessage"

content_type => "application/json"

http_method => "post"

format => "json"

mapping => [ "channel", "CXXXXXXXXX", "text", "%{message}" ]

headers => ["Authorization", "Bearer xoxb-xxxxxxxxxxx"]

}

}


문서 내 잘못된 정보)

https://www.elastic.co/guide/en/logstash/current/plugins-outputs-http.html#plugins-outputs-http-mapping


mapping 이 hash 로 되어 있는데 실제 나와 있는 예제로는 동작 하지 않습니다.


잘못된 예)

   mapping => {"foo" => "%{host}"
              "bar" => "%{type}"}


바른 예)

mapping => [ "channel", "CXXXXXXXXX", "text", "%{message}" ]



: