def setup_params(config, req, res)
      params = Hash.new("")
      params["a"] = req.peeraddr[3]
      params["b"] = res.sent_size
      params["e"] = ENV
      params["f"] = res.filename || ""
      params["h"] = req.peeraddr[2]
      params["i"] = req
      params["l"] = "-"
      params["m"] = req.request_method
      params["n"] = req.attributes
      params["o"] = res
      params["p"] = req.port
      params["q"] = req.query_string
      params["r"] = req.request_line.sub(/\x0d?\x0a\z/o, '')
      params["s"] = res.status       # won't support "%>s"
      params["t"] = req.request_time
      params["T"] = Time.now - req.request_time
      params["u"] = req.user || "-"
      params["U"] = req.unparsed_uri
      params["v"] = config[:ServerName]
      params
    end
def setup_params(config, req, res)
      params = Hash.new("")
      params["a"] = req.peeraddr[3]
      params["b"] = res.sent_size
      params["e"] = ENV
      params["f"] = res.filename || ""
      params["h"] = req.peeraddr[2]
      params["i"] = req
      params["l"] = "-"
      params["m"] = req.request_method
      params["n"] = req.attributes
      params["o"] = res
      params["p"] = req.port
      params["q"] = req.query_string
      params["r"] = req.request_line.sub(/\x0d?\x0a\z/o, '')
      params["s"] = res.status       # won't support "%>s"
      params["t"] = req.request_time
      params["T"] = Time.now - req.request_time
      params["u"] = req.user || "-"
      params["U"] = req.unparsed_uri
      params["v"] = config[:ServerName]
      params
    end
This format specification is a subset of mod_log_config of Apache:

 %a:: Remote IP address
 %b:: Total response size
 %e{variable}:: Given variable in ENV
 %f:: Response filename
 %h:: Remote host name
 %{header}i:: Given request header
 %l:: Remote logname, always "-"
 %m:: Request method
 %{attr}n:: Given request attribute from <tt>req.attributes</tt>
 %{header}o:: Given response header
 %p:: Server's request port
 %{format}p:: The canonical port of the server serving the request or the
              actual port or the client's actual port.  Valid formats are
              canonical, local or remote.
 %q:: Request query string
 %r:: First line of the request
 %s:: Request status
 %t:: Time the request was received
 %T:: Time taken to process the request
 %u:: Remote user from auth
 %U:: Unparsed URI
 %%:: Literal %