简体   繁体   中英

How to change log message format for LUA in NGINX?

Now I use

ngx.log(ngx.ALERT , "This is my message");

method to log messages in LUA. It gives a very descriptive message as shown in following. So how can I change the log format in NGINX to just output my alert message?

2017/03/19 12:32:10 [alert] 21994#0: *9 [lua] content_by_lua(proj1.conf:159):3: **This is my message**, client: 127.0.0.1, server: , request: "GET /service/user_info?access_token=323d106b-b170-4e91-9296-ef1a38b5af19 HTTP/1.1", host: "127.0.0.1:4000"

EDIT

I use this directive in nginx http block,

error_log stderr info;

you could do io.stderr:write("This is my message")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM