Code Monkey home page Code Monkey logo

Comments (2)

AlroneRhyn avatar AlroneRhyn commented on August 17, 2024

Hi Guys,

I've pached my import_logs.py as followed.

My Nginx log format :
log_format vhosts '$host $http_x_forwarded_for - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"';

My Common log format
_COMMON_LOG_FORMAT = (
'(?P<ip>[0-9]*.?[0-9]*.?[0-9]*.?[0-9]*)[\,\s?\S+]*\s+\S+\s+(?P<userid>\S+)\s+\[(?P<date>.*?)\s+(?P<timezone>.*?)\]\s+'
'"\S+\s+(?P<path>.*?)\s+\S+"\s+(?P<status>\S+)\s+(?P<length>\S+)'

[0-9]*.?[0-9]*.?[0-9]*.?[0-9]* allows me to prevent the "," to be part of the <ip> regex group and avoid the strict ipv4 regex filter
[\,\s?\S+]* allows me to have none OR multiple IPs and to keep the first one to be mached in piwik.

Hope it can be usefull, don't hesitate to tel me if my workaround is not a proper one

from matomo-log-analytics.

mattab avatar mattab commented on August 17, 2024

@AlroneRhyn Would you mind creating a pull request wih your change, and ideally updating our tests to show what you've improved? Thanks!

from matomo-log-analytics.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.