Coder Social home page Coder Social logo

fluent-plugin-slack's People

Contributors

cosmo0920 avatar eisuke avatar fujiwara avatar hirakiuc avatar hokkai7go avatar jwyjoy avatar kenjiskywalker avatar okkez avatar sett4 avatar sonots avatar sowawa avatar sue445 avatar yacchin1205 avatar yoheimuta avatar yoichi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fluent-plugin-slack's Issues

multi worker start failed

when i use:

<system>
  workers 4
</system>

[error]: config error file="/fluentd/etc/fluent.conf" error_class=Fluent::ConfigError error="Plugin 'buffered_slack' does not support multi workers configuration (Fluent::SlackOutput)"

`encode' / "\xE3" from ASCII-8BIT to UTF-8

In our production environment, to_json errors have occurred after updating td-agent v2.3.5.

2017-05-16 17:20:23 +0900 [error]: plugin/out_slack.rb:231:rescue in write: out_slack: error="\"\\xE3\" from ASCII-8BIT to UTF-8" error_class="Encoding::UndefinedConversionError"

This error is when fluent-plugin-slack to_json the output of fluent-plugin-rds-slowlog (v0.7.0).
Specifically, in-rds-slowlog outputs ASCII-8BIT encoded character string, but out_slack's to_json expects UTF-8 encoded character string, so it is an error.

Since the same thing can happen besides in-rds-slowlog, I want to use Yajl instead of JSON, because to_json method raise error when receive multibyte text.

How about that? If so, I will make a PR.

can not find slack plugin

I have installed the slack plugin. When checked with "gem list", it shows "fluent-plugin-slack (0.6.7)". And when i started fluentd, it shows "config error file="/etc/td-agent/td-agent.conf" error_class=Fluent::ConfigError error="Unknown output plugin 'slack'. Run 'gem search -rd fluent-plugin' to find plugins". It seems the plugin does not install, why?

multiple fluentd events are getting aggregated to single event

How to split it to individual events ?
I m using labels to route from fluentd source to slack output,
Using buffered parameters :

chunk_limit_size 1k
chunk_limit_records 1
flush_interval 1s

How to convert them to single message with one event ?
Also the message is not getting truncated.

Any help ?

Question: Use mulitple fields

Thank you for the awesome slack plugin. I am trying to post a slack attachment message with multiple fields but i unable to achieve it. I am only able to create single field per msg using the following configuration

<match kube.**>
      @type slack
      webhook_url "#{ENV['SLACK_WEBHOOK_URL']}"
      channel "#{ENV['SLACK_CHANNEL']}"
      username fluentd
      message %s
      message_keys log
      title Pod: %s
      title_keys kube_tag
      icon_emoji :ghost:
      flush_interval 1s
      mrkdwn true
      color danger
</match>

screen shot 2017-12-20 at 6 51 44 pm

I would like to add other fields as well but not able to figure out how can we achieve it.

Can't send

I try to send logs to my slack team using this but it won't send any logs.

2015-05-14 21:18:04 +0900 [info]: out_slack: post_message {:channel=>"#logs", :text=>"oijwef\n", :mrkdwn=>true, :link_names=>true}
2015-05-14 21:18:04 +0900 [warn]: temporarily failed to flush the buffer. next_retry=2015-05-14 21:20:03 +0900 error_class="NameError" error="uninitialized constant Net::OpenTimeout" instance=70183716234940
  2015-05-14 21:18:04 +0900 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-slack-0.6.0/lib/fluent/plugin/out_slack.rb:131:in `rescue in write'
  2015-05-14 21:18:04 +0900 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-slack-0.6.0/lib/fluent/plugin/out_slack.rb:128:in `write'
  2015-05-14 21:18:04 +0900 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.55/lib/fluent/buffer.rb:296:in `write_chunk'
  2015-05-14 21:18:04 +0900 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.55/lib/fluent/buffer.rb:276:in `pop'
  2015-05-14 21:18:04 +0900 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.55/lib/fluent/output.rb:311:in `try_flush'
  2015-05-14 21:18:04 +0900 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.55/lib/fluent/output.rb:132:in `run'
2015-05-14 21:18:06 +0900 applicationlog.testtest: {"message":"oijwef"}

my config

<match applicationlog.testtest>
type copy
<store>
  type stdout
</store>
<store>
  type slack
  webhook_url http://hooks.slack.com/services/xxxxxx/xxxxx/xxxxxxxxx
  channel logs
  flush_interval 1s
</store>
</match>

Can not find slack plugin

After using "fluent-gem install fluent-plugin-slack" to install slack plugin, when start td-agent.service, failed due to config error file="/etc/td-agent/td-agent.conf" error_class=Fluent::ConfigError error="Unknown output plugin 'slack'. Run 'gem search -rd fluent-plugin' to find plugins". It's seems strange.

Escaping < and > breaks formatted links

In c5b7158 code was added to escape <, >, and & per Slack's formatting Docs. However, by escaping these values across the board, formatted links like the following no longer work: <https://google.com|My Link>

Ability to use more than one slack plugin with custom icons/username options

Hi there,

I have the following use case:

  • in my fluentd config I'm splitting logs into error and performance channels (tags)
  • so I want to apply different slack icons/usernames per each slack plugin (Now it's impossible because slack plugin caches the common config and icon_emoji/username options are part of it)

How come no examples for sending to Slack?

The examples seem to show how to receive messages from Slack, rather than sending to Slack. I'm not sure why anyone would want the former. I tried to get it working but failed. I've documented the issue here: https://serverfault.com/questions/1160392/how-can-i-resolve-fluentd-plugin-slack-error-when-starting-fluentd-daemon-undef

It would be awesome if someone could help me get this working, or post some examples of sending to Slack to the README. I tried getting help on the Slack server for Fluent but no-one bit.

Line breaks in posted value are ignored

Running into an issue with the posted value data not actually honouring line breaks.

From the log:
out_slack: post_message {:attachments=>[{:fallback=>"Log:logs.one.one-api.err.err.log Host:one-prod-ip-10-0-7-52", :fields=>[{:title=>"Log:logs.foo.foo-api.err.err.log Host:foo-prod-ip-10-0-7-52", :value=>"Error: Invalid LocationID \nStatus Code: 404\nType: notFoundError\n"}], :color=>"danger", :mrkdwn_in=>["text", "fields"]}], :channel=>"#jenkins", :username=>"fluentd", :icon_emoji=>":ghost:", :mrkdwn=>true, :link_names=>true}

I am new to fluentd, is there a trick to adding line breaks?
This is what was posted into slack:
Log:logs.foo.foo-api.err.err.log Host:foo-prod-ip-10-0-7-52
Error: Invalid LocationID \nStatus Code: 404\nType: notFoundError
I did try <br> as well, and that just posted <br> into the slack channel.

I am using the webhooks implementation for this.
Any suggestions?

Travis

@sowawa Could you turn on travis and put a badge to it on README.md?

The specified key 'message' not found

I'm trying to use your slack plugin, but the logs generated by my docker engine seem to be formatted as a json with a log entry instead of a message one.

I'm using docker 1.9.1 (API version 1.21), fluentd 0.12.22 and fluent-plugin-slack (0.6.2). My fluentd configuration is:

<match slack.*>
  type slack
  webhook_url  https://hooks.slack.com/services/x/y/z
  channel monitoring
  username microservices
  icon_emoji :ghost:
  flush_interval 60s
</match>

And after trying a docker run -d --log-driver=fluentd --log-opt fluentd-tag="slack.test" alpine echo "hello", I obtain the next warning from fluentd:

2016-05-03 14:30:17 +0000 [warn]: out_slack: the specified key 'message' not found in record. [{"container_id"=>"7e4dde134cc57379c0a924b8c5ad3f5b463d5d490ca2061561a6261e98da4c34", "container_name"=>"/goofy_babbage", "source"=>"stdout", "log"=>"hello", "time"=>"14:29:35", "tag"=>"slack.test"}]
2016-05-03 14:30:17 +0000 [info]: out_slack: post_message {:channel=>"#devops", :text=>"\n", :username=>"ecs", :icon_emoji=>":ghost:", :mrkdwn=>true, :link_names=>true}

Any idea?

Truncating of messages

I have recently come to this issue, which is still a problem. My messages are truncated even after not that many characters roughly 2k. Any idea how to solve that?

Toward v2

This issue describes a loadmap to v2.

Once release v1 (nothing is changed with v0.xx) to do semantic versioning, then work for v2.

Breaking changes:

  1. To fix #28, revert escaping special characters in message.
  2. By historical reasons, default values of some parameters are different with Slack API default values. Align with Slack API default values.
  3. Allow adding arbitrary slack parameters
  4. Migrate to Fluentd v0.14 (v1) API.

Allow adding arbitrary slack parameters

Slack API itself evolves, and will support new parameters. I want to support new parameters without updating slack plugin.

Maybe we can achieve by changing interfaces as:

<match slack>
  @type slack
  webhook_url https://hooks.slack.com/services/XXX/XXX/XXX
  <payload>
    channel general
    username sonots
    # arbitrary key=val parameters can be added
  </payload>
</match>

If we support only Fluentd >= v0.14.20, users can get dynamic values from nested records via record accessor as:

ref. https://www.fluentd.org/blog/fluentd-v0.14.20-has-been-released

<match slack>
  @type slack
  webhook_url https://hooks.slack.com/services/XXX/XXX/XXX
  <payload>
    channel $.foo.channel
    username $["username"]
    # arbitrary key=val parameters can be added
  </payload>
</match>

TODO: Test whether we can write ruby codes combined with record accessor as #{$.text..gsub(/&/, '&amp;').gsub(/</, '&lt;').gsub(/>/, '&gt;')} (hmm, looks not possible) so that users can write their own escaping function by themselves to support #22.

TODO: Think how to support nested parameters. Create config_section dynamically?

payload
  channel
  username
  attachments
     blah blah

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.