# Define JSON log format - must be loaded before config that references it.
# Note that each line is fully enclosed in single quotes. Commas in arrays are
# intentionally inside the single quotes.
log_format  ietfjson  escape=json
  '{'
    '"time":"$${keepempty}time_iso8601",'
    '"remote_ip":"$${keepempty}remote_addr",'
    '"request":"$${keepempty}request",'
    '"host":"$${keepempty}host",'
    '"path":"$${keepempty}request_uri",'
    '"method":"$${keepempty}request_method",'
    '"status":"$${keepempty}status",'
    '"len_bytes":"$${keepempty}body_bytes_sent",'
    '"duration_s":"$${keepempty}request_time",'
    '"referer":"$${keepempty}http_referer",'
    '"user_agent":"$${keepempty}http_user_agent",'
    '"x_forwarded_for":"$${keepempty}http_x_forwarded_for",'
    '"x_forwarded_proto":"$${keepempty}http_x_forwarded_proto",'
    '"cf_connecting_ip":"$${keepempty}http_cf_connecting_ip",'
    '"cf_connecting_ipv6":"$${keepempty}http_cf_connecting_ipv6",'
    '"cf_ray":"$${keepempty}http_cf_ray",'
    '"asn":"$${keepempty}http_x_ip_src_asnum"'
  '}';