Gluz
Gluz

Reputation: 3264

Nginx disable or decode url encoding when writing to access log

I have an open resty nginx with lua code that enhance the data and then I write this data to the access log for data analysis. The data that the lua code produce includes double quotes but nginx write it to the access log as \x22. Can I disable this behaviour or decode it back to "?

Upvotes: 2

Views: 1975

Answers (1)

Shai Brumer
Shai Brumer

Reputation: 56

Short answer you can't. But, you can run an URL decode after logrotate.

Here is the command :

awk -v RS='\\\\x[0-9]{2}' 'RT{ORS=sprintf("%c", strtonum("0" substr(RT, 2)))} 1'

Upvotes: 4

Related Questions