# How to customize KONG log file name? (For example, we expected the access log file name is kong-access-{hostname}-{yyyymmdd-hhmmss}.log)

**URL:** https://discuss.konghq.com/t/how-to-customize-kong-log-file-name-for-example-we-expected-the-access-log-file-name-is-kong-access-hostname-yyyymmdd-hhmmss-log/7751
**Category:** Questions
**Created:** [January 17, 2021, 6:06am UTC](https://discuss.konghq.com/t/how-to-customize-kong-log-file-name-for-example-we-expected-the-access-log-file-name-is-kong-access-hostname-yyyymmdd-hhmmss-log/7751 "2021-01-17T06:06:09Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![feizhichao](https://avatars.discourse-cdn.com/v4/letter/f/5daacb/32.png) [@feizhichao](https://discuss.konghq.com/u/feizhichao)
#### Post date: [January 17, 2021, 6:06am UTC](https://discuss.konghq.com/t/how-to-customize-kong-log-file-name-for-example-we-expected-the-access-log-file-name-is-kong-access-hostname-yyyymmdd-hhmmss-log/7751/1 "2021-01-17T06:06:09Z")

</div>

Hi All,  
Good morning.  
We want to customize KONG log file name, and we have tried few ways to implement this requirement, but finally, we don’t successful. So, I come to here to see if someone have any solution to fix my problem. Thanks for your help in advance.  
Environment:  
Platform: k8s  
Kong Version: 2.0.4  
I have tried below methods:

1. Modify shell script ‘docker-entrypoint.sh’  
a) Modify shell script ‘docker-entrypoint.sh’ make sure ‘/dev/stdout’ and ‘/dev/stderr’ associate to log file.  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/konghq/original/2X/c/cdc689723bfcab6f071072c6265acdab63680aef.png)

b) Set the log related env in k8s YAML file

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/konghq/original/2X/7/79de8e91adc3f5ed3f0c61ea74dc30096c564ddd.png)

Result:  
After we recreated the k8s prod, we found the log file has created and also associated with ‘/dev/stdout’ and ‘/dev/stderr’. But no any log Info write to the log files.

1. Modify lua script ‘nginx\_kong.lua’  
We modified below highlighted line, its original line is ‘access\_log ${{PROXY\_ACCESS\_LOG}};’

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/konghq/original/2X/6/6d93c8a079e317b03f21ae820ec08a12d162194e.png)

Result:  
After we recreated the k8s prod, we found the access log file name is ‘kong\_access.log’ not ‘kong\_access${{HOSTNAME}}.log’, and we are sure the environment variable ‘HOSTNAME’ exists in kong POD. We also sure the log can right write to file ‘kong\_access.log’, but the file name doesn’t contain the value of env ‘HOSTNAME’.

Sincerely wish you and your family happiness.
