title: How to add HTTP Headers Logback Logstash
body: <p>I read through the following documentation but cannot figure out what other configuration I need: <a href="https://github.com/logstash/logstash-logback-encoder#header-fields" rel="nofollow noreferrer">https://github.com/logstash/logstash-logback-encoder#header-fields</a></p>
  
  <p>My config file: 
      
      </p>
  
  <pre><code>    &lt;include resource="org/springframework/boot/logging/logback/defaults.xml" /&gt;
  
      &lt;include resource="org/springframework/boot/logging/logback/console-appender.xml" /&gt;
  
      &lt;property name="LOG_FILE" value="${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}}/spring.log}"/&gt;
  
      &lt;appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"&gt;
          &lt;encoder class="net.logstash.logback.encoder.LogstashEncoder"&gt;
              &lt;customFields&gt;{"app_name":"${APP_NAME:-N/A}","app_version":"${APP_VERSION:-N/A}","hostname":"${HOST:-N/A}","environment":"${environment:-${ENVIRONMENT:-N/A}}"}&lt;/customFields&gt;
              &lt;includeContext&gt;false&lt;/includeContext&gt;
              &lt;timeZone&gt;UTC&lt;/timeZone&gt;
         &lt;/encoder&gt;
  
        &lt;encoder class="net.logstash.logback.encoder.LogstashAccessEncoder"&gt;
          &lt;fieldNames&gt;
              &lt;requestHeaders&gt;request_headers&lt;/requestHeaders&gt;
          &lt;/fieldNames&gt;
        &lt;/encoder&gt;
  
          &lt;file&gt;${LOG_FILE}&lt;/file&gt;
          &lt;rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"&gt;
              &lt;fileNamePattern&gt;${LOG_FILE_ROTATION:-${LOG_FILE}%d{yyyy-MM-dd}.%i}&lt;/fileNamePattern&gt;
              &lt;maxHistory&gt;${LOG_FILE_ROTATION_MAX_HISTORY:-1}&lt;/maxHistory&gt;
              &lt;totalSizeCap&gt;${LOG_FILE_ROTATION_TOTAL_SIZE_CAP:-3GB}&lt;/totalSizeCap&gt;
              &lt;maxFileSize&gt;${LOG_FILE_ROTATION_MAX_FILE_SIZE:-1GB}&lt;/maxFileSize&gt;
          &lt;/rollingPolicy&gt;
      &lt;/appender&gt;
  
      &lt;root level="${LOG_LEVEL:-INFO}"&gt;
          &lt;appender-ref ref="CONSOLE" /&gt;
          &lt;appender-ref ref="FILE" /&gt;
      &lt;/root&gt;
  
  &lt;/configuration&gt;
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>    java.lang.IllegalStateException: Logback configuration error detected: 
  ERROR in ch.qos.logback.core.joran.spi.Interpreter@19:29 - no applicable action for [requestHeaders], current ElementPath  is [[configuration][appender][encoder][fieldNames][requestHeaders]]
  </code></pre>