# Custom json access log format, unable to set conditional format of logs

**URL:** <https://discuss.konghq.com/t/custom-json-access-log-format-unable-to-set-conditional-format-of-logs/12656>\
**Category:** General\
**Created:** [May 8, 2024, 3:07pm UTC](https://discuss.konghq.com/t/custom-json-access-log-format-unable-to-set-conditional-format-of-logs/12656 "2024-05-08T15:07:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ashish\_Swarnkar](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/ashish_swarnkar/32/4473_2.png) [@Ashish\_Swarnkar](https://discuss.konghq.com/u/Ashish_Swarnkar)\
**Post date:** [May 8, 2024, 3:07pm UTC](https://discuss.konghq.com/t/custom-json-access-log-format-unable-to-set-conditional-format-of-logs/12656/1 "2024-05-08T15:07:21Z")

</div>

I have kong’s helm chart setup, i have induced custom json log format as env variable

- name: KONG\_NGINX\_HTTP\_LOG\_FORMAT  
value: apm escape=json ‘{“time\_local”:“$time\_local”,“request”:“$request”,“request\_length”:$request\_length,“status”:$status,“bytes\_sent”:$bytes\_sent,“body\_bytes\_sent”:$body\_bytes\_sent,“http\_referer”:“$http\_referer”,“http\_user\_agent”:“$http\_user\_agent”,“upstream\_addr”:“$upstream\_addr”,“upstream\_status”:$upstream\_status,“request\_time”:$request\_time,“upstream\_response\_time”:$upstream\_response\_time,“upstream\_connect\_time”:$upstream\_connect\_time,“upstream\_header\_time”:$upstream\_header\_time,“x\_forwarded\_for”:“$http\_x\_forwarded\_for”,“remote\_addr”:“$remote\_addr”,“request\_path”:“$request\_uri”}’

but cases like upstream\_response\_time, upstream\_header\_time result in empty if request is terminated at kong layer. I get improper json format as these field are integer not string, cannot send proper json logs to kibana.

any idea if we can set those header values by default = 0 or -1 incase values are absent, should overwrite when values are present
