I am having a problem setting up a custom log format for WPEngines nginx access log files.

Avatar
  • updated

Here is a sample of 3 lines a sample logfile with domain changed for privacy.  

19/Aug/2020:00:19:17 +0000|v1|108.248.157.62|domain.com|200|338099|127.0.0.1:9002|0.004|0.004|GET / HTTP/1.0|0|0|-

19/Aug/2020:00:19:18 +0000|v1|108.248.157.62|domain.com|200|66|127.0.0.1:9002|0.524|0.525|GET /wp-json/wpstatistics/v1/hit?_=1597796360&_wpnonce=0782569d19&wp_statistics_hit_rest=yes&ua=Mozilla/5.0%20(Windows%20NT%2010.0;%20Win64;%20x64)%20AppleWebKit/537.36%20(KHTML,%20like%20Gecko)%20Chrome/84.0.4147.125%20Safari/537.36&url=https://domain.com/&referred= HTTP/1.0|0|0|-


19/Aug/2020:00:19:18 +0000|v1|108.248.157.62|domain.com|200|39888|-|-|0.000|GET /wp-content/uploads/2019/05/plus-no-mask-1.jpg HTTP/1.0|0|0|-

Any help would be appreciated.

Avatar
Michael

Unfortunately the program doesn't support log formats with fields separated with the | character.

You can find information on setting a log format supported by the program at https://www.weblogexpert.com/info/NginxLogs.htm 

Avatar

Hi Michael;

That is a bummer.  I was hoping that the regex type code that is used to set the format would allow a custom log file to be generated.  But you are telling me that it will not be possible to do that.  Am I understanding you correctly?

Thanks,

Herb

Avatar
Michael

Hi Herb,

Yes, unfortunately it's correct. We don't use regex's for log parsing (because of required performance) but use code-based parsing. We do allow some log format customization for Apache logs (and similar like Nginx ones) but the option to use the | character as a separator isn't supported now, only spaces and tabs are supported.