title: Fluentd Configuration File, get filename in <source> and pass it to <match> as a tag
body: <p>I am trying to write a clean configuration file for fluentd + fluentd-s3-plugin and use it for many files. </p>
  
  <p>I want to avoid copy and pasting every <code>&lt;source&gt;</code> and every <code>&lt;match&gt;</code> for every file, so I would like to make it kinda dynamic. What I have until now:</p>
  
  <pre><code>  &lt;source&gt;
      @type tail
      path /var/www/blabla/blabla/log/production.log
      pos_file /var/www/blabla/blabla/log/production.log.pos
      tag production-log
      format /(?&lt;time&gt;.*)/
    &lt;/source&gt;
  
  
    &lt;match production-log&gt;
      @type s3
  
        s3_bucket xxxx
        s3_region xxxx
  
        path "staging/%Y/%m/%d/#{Socket.gethostname}/"
        s3_object_key_format "%{path}productionlog-%{time_slice}-#{Socket.gethostname}-%{index}.%{file_extension}"
  
        # if you want to use ${tag} or %Y/%m/%d/ like syntax in path / s3_object_key_format,
        # need to specify tag for ${tag} and time for %Y/%m/%d in &lt;buffer&gt; argument.
        &lt;buffer tag,time&gt;
          @type file
          tag ${tag}
          path /var/www/blabla/blabla/log/buffer/
          timekey 3600 # (default 3600) 1 hour partition
          timekey_wait 1m
          timekey_use_utc true # use utc
  
        &lt;/buffer&gt;
        &lt;format&gt;
          @type json
        &lt;/format&gt;
    &lt;/match&gt;
  </code></pre>
  
  <p>As you can see, I use production-log many times, so my questions are 2:</p>
  
  <p>How do I use the filename in <code>tag</code>?</p>
  
  <p>How do I use this passed tag in <code>s3_object_key_format</code>? (I know there are instructions commented but I don't get it)</p>