matomo-org / matomo-log-analytics

Import any kind of server logs in Matomo for powerful log analytics. Universal log file parsing and reporting.
https://matomo.org/log-analytics/
GNU General Public License v3.0
227 stars 119 forks source link

I offer a working regex for default Nginx Proxy Manager log #345

Open antoninchadima opened 1 year ago

antoninchadima commented 1 year ago

https://nginxproxymanager.com/

nginx.conf: https://github.com/NginxProxyManager/nginx-proxy-manager/blob/develop/docker/rootfs/etc/nginx/nginx.conf log_format proxy '[$time_local] $upstream_cache_status $upstream_status $status - $request_method $scheme $host "$request_uri" [Client $remote_addr] [Length $body_bytes_sent] [Gzip $gzip_ratio] [Sent-to $server] "$http_user_agent" "$http_referer"'

example: [27/Jan/2023:10:22:32 +0000] - 200 200 - POST https data.ucl.cas.cz "/apps/text/session/sync" [Client 147.231.80.67] [Length 251] [Gzip -] [Sent-to data.localdomain] "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36" "-"

regex: \[(?P<date>.*?) (?P<timezone>.*?)\] \S+ \S+ (?P<status>\S+) \- (?P<method>\S+) \S+ (?P<host>[\w\-\.]*) \"(?P<path>.*?)\" \[Client (?P<ip>[\w*.:-]+)\] \[Length (?P<length>\S+)\].*? \"(?P<user_agent>.*?)\" \"(?P<referrer>.*?)\"

hanscees commented 1 year ago

have you actually succeeded in importing these data? In my trial and error no ip-addresses are recorded other than 0.0.0.0