fluent-plugins-nursery / fluent-plugin-remote_syslog

Fluentd plugin for output to remote syslog serivce (e.g. Papertrail)
https://github.com/dlackty/fluent-plugin-remote_syslog
MIT License
68 stars 53 forks source link

Redirect logs to a syslog server based on the value of a field #49

Closed mareban closed 1 year ago

mareban commented 2 years ago

Hello,

Is it possible for forward log on a dedicated remote syslog server based on the value of a field please (placeholder seems to be supported) ?

@type remote_syslog host ${record["Site"]} port 9514

Site will be a fqdn where the logs should be forwarded !

Thanks for your help

PS : from this, it should be possible isn't it ? https://github.com/fluent-plugins-nursery/fluent-plugin-remote_syslog/pull/31

daipom commented 1 year ago

Sorry for the late reply.

You can use placeholders. This works for me, so it might be possible.

  <source>
    @type sample
    tag "test"
    sample {"message":"Hello world.","site":"127.0.0.1"}
    rate 1
  </source>
  <match test.**>
    @type remote_syslog
    host "${site}"
    port 22222
    <buffer site>
      flush_mode immediate
    </buffer>
    <format>
      @type "single_value"
      message_key "message"
    </format>
  </match>
  <source>
    @type syslog
    tag "receive"
    port 22222
    bind "127.0.0.1"
  </source>
  <match receive.**>
    @type stdout
  </match>
github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has been open 30 days with no activity after answered. Remove stale label or comment or this issue will be closed in 7 days.

github-actions[bot] commented 1 year ago

This issue was automatically closed because of stale in 7 days