fluent-plugin-slack icon indicating copy to clipboard operation
fluent-plugin-slack copied to clipboard

Question: Use mulitple fields

Open chhetripradeep opened this issue 8 years ago • 3 comments

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.

chhetripradeep avatar Dec 20 '17 13:12 chhetripradeep

Hi,

Not sure if this is still relevant to you, but you add multiple placeholders for your fields in the message section, then in message_keys you put a comma delimited list of keys in order of replacement, eg

message The current temperature is %s and the weight is %s message_keys temp,weight

andrewl avatar May 24 '18 21:05 andrewl

@andrewl Thanks. let me try it and get back to you.

chhetripradeep avatar May 25 '18 11:05 chhetripradeep

@andrewl do you know if we can make use of slack attachments to make it look pretty ?

chhetripradeep avatar May 25 '18 11:05 chhetripradeep