# Custom nginx log format

**URL:** <https://discuss.konghq.com/t/custom-nginx-log-format/2641>\
**Category:** Questions\
**Created:** [January 18, 2019, 12:58am UTC](https://discuss.konghq.com/t/custom-nginx-log-format/2641 "2019-01-18T00:58:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kamil](https://avatars.discourse-cdn.com/v4/letter/k/94ad74/32.png) [@Kamil](https://discuss.konghq.com/u/Kamil)\
**Post date:** [January 18, 2019, 12:58am UTC](https://discuss.konghq.com/t/custom-nginx-log-format/2641/1 "2019-01-18T00:58:23Z")

</div>

Hi Folks,

I’m trying to change the default log format for kong by modifying nginx\_kong.lua template file:

> <https://github.com/Kong/kong/blob/master/kong/templates/nginx_kong.lua>

I can see my configuration in /usr/local/kong/nginx-kong.conf file but log format isn’t changed.

I’m trying to match nginx ingress controller format:

```
# The following is a sneaky way to do "set $the_real_ip $remote_addr"
# Needed because using set is not allowed outside server blocks.
map '' $the_real_ip {

  # Get IP address from Proxy Protocol
  default $proxy_protocol_addr;

}
  log_subrequest on;
  log_format upstreaminfo '$the_real_ip - [$the_real_ip] - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $request_length $request_time [$proxy_upstream_name] $upstream_addr $upstream_response_length $upstream_response_time $upstream_status $req_id';

map $request_uri $loggable {

  default 1;
}

# Reverse proxies can detect if a client provides a X-Request-ID header, and pass it on to the backend server.
# If no such header is provided, it can provide a random value.
map $http_x_request_id $req_id {
  default $http_x_request_id;

  "" $request_id;

}

server {
    server_name kong;
    set $proxy_upstream_name "-";

```

Any ideas?

I’m using the following sw version:  
Kong 1.0.0  
Kong ingress 0.3.0

Also how do I dump active configuration?

Thanks
