<source>
  @type dummy
  tag test
</source>
<source>
  @type dummy
  tag test2
</source>
<source>
  @type dummy
  tag test3
</source>
<source>
  @type dummy
  tag test4
</source>
<source>
  @type dummy
  tag test5
</source>

<match test>
  @type forward
  flush_interval 0
  <security>
    self_hostname output.testing.local
    shared_key    secure_communication_is_awesome
  </security>
  <server>
    host 127.0.0.1
    port 24224
    username user1
    password yes_this_is_user1
    shared_key using_different_key_makes_us_secure
  </server>
</match>

<match test2>
  @type forward
  flush_interval 0
  <security>
    self_hostname output-alt1.testing.local
    shared_key    using_different_key_makes_us_secure
  </security>
  <server>
    host 127.0.0.1
    port 24224
    username user1
    password yes_this_is_user1
  </server>
  <server>
    host 127.0.0.1
    port 24224
    username user2
    password yes_this_is_really_user2
  </server>
</match>

<match test3>
  @type forward
  flush_interval 0
  <security>
    self_hostname output-fail1.testing.local
    # default key: fail
    shared_key    secure_communication_is_awesome
  </security>
  <server>
    host 127.0.0.1
    port 24224
    username user1
    password yes_this_is_user1
    # [warn]: Shared key mismatch address="127.0.0.1" hostname="output-fail1.testing.local"
  </server>
</match>

<match test4>
  @type forward
  flush_interval 0
  <security>
    self_hostname output-fail2.testing.local
    shared_key    using_different_key_makes_us_secure
  </security>
  <server>
    host 127.0.0.1
    port 24224
    username user3
    # user3 (user denied): fail
    password noooooo_this_may_not_be_user3
    # [warn]: Authentication failed address="127.0.0.1" hostname="output-fail2.testing.local" username="user3"
  </server>
</match>

<match test5>
  @type forward
  flush_interval 0
  <security>
    self_hostname output-fail3.testing.local
    shared_key    using_different_key_makes_us_secure
  </security>
  <server>
    # another ip (host rejected): fail
    # This pattern will work only with Ruby 2.3
    host "#{Socket.getifaddrs.select{|i| i.addr.ipv4? }.reject{|i| i.addr.ip_address == '127.0.0.1' }.first.addr.ip_address}"
    port 24224
    username user1
    password yes_this_is_user1
    # [warn]: Anonymous client disallowed address="192.168.1.75" hostname="output-fail3.testing.local"
  </server>
</match>
