title: How to write only logs with 200 status
body: <p>I'm trying to figure out how to do the following:</p>
  
  <ol>
  <li><p>Request is coming in.</p></li>
  <li><p><code>HttpLuaModule</code> performs some action against the request. If request is valid than Lua will finish processing with <code>ngx.exit(202)</code>. But there are some conditions that may (and will) occur during the processing and <code>nginx</code> might return 403 , 404, 503 Errors. </p></li>
  </ol>
  
  <p>What I want to do is to write to access logs only requests that have 200 Status code. 
  Basically I would like to do something like this:</p>
  
  <pre><code>location /foo {
      content_by_lua_file "/opt/nginx/lua/process.lua";
      if (status == 200) {
          access_log "/path/to/the/access_log"
      } 
  </code></pre>
  
  <p>I'm very new to both nginx and lua so for me it's a bit of a challenge to figure out where to place and if statement (ether after <code>content_by_lua_file</code> or in side lua file) and what this if statement should look like.</p>