Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Caddy json log support #366

Closed
wants to merge 142 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
ae7f49d
Allow wildcards for importing logs
geographika Jun 26, 2017
c233943
Add haproxy log format
Sep 27, 2018
f5a420b
Create haproxy.log
Sep 27, 2018
c36f4d7
fix tests
Sep 27, 2018
16d9657
Update README.md
Sep 27, 2018
0afb8ab
fix timezone calculation for non-integer timezones
mackuba Nov 29, 2018
9d39a37
Apply config.options.seconds_to_add_to_date to _...ts tracker params …
diosmosis Jan 14, 2019
3af09d7
added some tests for TimeHelper
mackuba Nov 29, 2018
3d1ddcf
2to3 and basic adjustments
Findus23 Feb 14, 2019
371d44d
remove json import fallback (json is supported since 2.6)
Findus23 Feb 14, 2019
4b79cda
errors don't have messages anymore, but args
Findus23 Feb 14, 2019
5999bfe
remove string decode, it shouldn't be needed anymore
Findus23 Feb 14, 2019
8f874a5
dicts don't have an order so you can't test for it
Findus23 Feb 14, 2019
54e303f
update travis tests
Findus23 Feb 14, 2019
864cddf
strings don't have to be equal as json dicts have no order
Findus23 Feb 14, 2019
36bb16c
travis only supports python 3.7 with the xenial image
Findus23 Feb 14, 2019
04b186d
update comment
Findus23 Feb 14, 2019
673b2f7
Added new command line option '--php-binary' that let's the user spec…
Apr 8, 2019
f5a1e28
also test travis on python 3.8-dev
Findus23 Sep 12, 2019
777ff8f
replace dict with OrderedDict where logic depends on order
Findus23 Sep 12, 2019
e9dedce
minor formatting changes
Findus23 Sep 12, 2019
c20c576
fix encoding issues
Findus23 Sep 12, 2019
145ca5c
don't convert Url from string to bytes
Findus23 Sep 12, 2019
14075e8
remove python2 comment
Findus23 Sep 12, 2019
3156367
replace optparse with argparse
Findus23 Sep 12, 2019
aaf0a2d
make configparser not strict
Findus23 Sep 12, 2019
60732cd
convert process output to string
Findus23 Sep 12, 2019
67b7b1f
search updatetoken.php relative to config.ini.php instead of script
Findus23 Sep 12, 2019
d1574c2
replace yield tests with simple functions
Findus23 Sep 12, 2019
312de97
fix regex in tests
Findus23 Sep 12, 2019
f103695
use OrderedDict in tests
Findus23 Sep 12, 2019
ee34563
subclassing object is useless as it is the default in Python3
Findus23 Sep 13, 2019
426b5ea
simply how the Matomo (HTTP) class works
Findus23 Sep 13, 2019
8468161
fix tests
Findus23 Sep 13, 2019
44674a7
rename HTTP class
Findus23 Sep 13, 2019
5ce5c09
fix string handling in Basic Auth
Findus23 Sep 13, 2019
1753845
properly display 404 error
Findus23 Sep 13, 2019
615a9e0
Merge remote-tracking branch 'origin/master' into python3-2019
sgiehl Oct 21, 2019
c4c3bae
Merge remote-tracking branch 'origin/master' into python3-2019
sgiehl Oct 21, 2019
8ef5d9c
Merge branch 'master' into python3-2019
sgiehl Jan 13, 2020
4794df0
Compatibility with app specific tokens
tsteur Jan 13, 2020
066b6a4
Update tests/test_main.py
sgiehl Feb 15, 2020
61b4d5f
adds missing spaces
sgiehl Feb 15, 2020
edf9c40
remove debugging code
sgiehl Feb 15, 2020
da922da
adjust supported versions
sgiehl Feb 19, 2020
50def89
run tests against 3.8 stable
sgiehl Feb 19, 2020
178bdfb
make it possible to have separated date and time field
Jun 30, 2017
681cac3
adds a simple test for log format with splitted date and time
sgiehl Dec 13, 2017
5eaeb20
Merge pull request #180 from matomo-org/w3cdatetime
sgiehl Mar 2, 2020
953277e
use trusty dist on travis to fix python 2.6 tests
sgiehl Mar 2, 2020
3296fe9
Adds Incapsula log format (not autodetected)
sgiehl Jul 4, 2017
fe2f5ab
allow empty status and length
sgiehl Jul 6, 2017
9bb0fdf
improve format to fix handling for empty status or length
sgiehl Jul 7, 2017
8072cb7
Fix host/path pattern
sgiehl Jul 10, 2017
2e62d7e
rename format
sgiehl Jul 12, 2017
7596e73
add format identifier
sgiehl Feb 4, 2018
53388f1
fix tests
sgiehl Oct 21, 2019
c6b9088
fix typos marked by codespell
Findus23 Mar 24, 2020
57482e2
Merge pull request #259 from matomo-org/codespell
sgiehl Mar 24, 2020
0af17e7
Use new performance metric for server generation time
sgiehl Apr 15, 2020
9c7c9c0
Merge pull request #254 from matomo-org/6559
sgiehl Apr 15, 2020
89e9323
Merge pull request #260 from matomo-org/performancemetrics
sgiehl Apr 17, 2020
7266244
json2 not used anymore
diosmosis Apr 24, 2020
e3d4530
Remove Gears detection
sgiehl May 15, 2020
69d5bcf
use new paramter in log importer
diosmosis May 17, 2020
099e2bb
Merge pull request #263 from matomo-org/mtm-pwd
diosmosis May 17, 2020
99e3b53
Merge pull request #262 from matomo-org/removegears
sgiehl May 20, 2020
3d5697f
removes director detection
sgiehl May 26, 2020
b1b877b
Merge pull request #265 from matomo-org/removedirector
sgiehl May 27, 2020
8783885
Merge branch 'python3-2019' of git://github.com/Findus23/piwik-log-an…
sgiehl Jun 5, 2020
e2d25bf
adjust travis.yml
sgiehl Jun 5, 2020
1c0d2f5
add Zabbix and GoogleStackdriverMonitoring agents
Neo2SHYAlien Jun 8, 2020
47cec27
try to fix possible decoding problems
sgiehl Jun 8, 2020
08683e8
adds test for file encoding
sgiehl Jun 9, 2020
bec09db
update readme
sgiehl Jun 16, 2020
84fe9c9
Merge pull request #267 from matomo-org/python3
diosmosis Jun 21, 2020
12b98e8
Merge pull request #236 from mackuba/timezones
diosmosis Jun 22, 2020
9ec2b1f
Merge branch '3.x-dev' into seconds-to-add-date-ts-params
diosmosis Jun 22, 2020
54f9453
add tests for new option
diosmosis Jun 22, 2020
847ef6e
get tests to pass
diosmosis Jun 22, 2020
b51eaac
Merge pull request #237 from matomo-org/seconds-to-add-date-ts-params
diosmosis Jun 22, 2020
01d8ad2
Merge pull request #222 from fdellwing/patch-1
diosmosis Jun 22, 2020
c46c8fb
Merge branch '3.x-dev' into incapsula
diosmosis Jun 22, 2020
c07986e
Merge pull request #184 from matomo-org/incapsula
diosmosis Jun 22, 2020
0111c86
Merge branch '3.x-dev' into patch-2
diosmosis Jun 22, 2020
58e162e
add globbing multiple args support + test
diosmosis Jun 22, 2020
856857c
try to fix travis build
diosmosis Jun 22, 2020
7150e74
Merge pull request #178 from geographika/patch-2
diosmosis Jun 22, 2020
7dcf33a
Merge pull request #266 from Neo2SHYAlien/4.x-dev
sgiehl Jun 23, 2020
5a1f5f8
Merge branch '3.x-dev' into 4.x-dev
diosmosis Jun 23, 2020
a1e510b
always disable queued tracking when sending requests from log import
sgiehl Jul 22, 2020
aa4a17f
Merge pull request #274 from matomo-org/disablequeue
tsteur Jul 22, 2020
b924a4d
try to fix using stdin
sgiehl Jul 24, 2020
a314394
Merge pull request #275 from matomo-org/stdin
tsteur Jul 26, 2020
7a96907
Merge branch '3.x-dev' into 4.x-dev
sgiehl Jul 27, 2020
16bf5ec
Increase header limit to avoid possible error
sgiehl Jul 27, 2020
29ee294
Support both AWS Application and Elastic Load Balancer log formats
Oct 2, 2020
f3a53b8
Merge pull request #280 from tabascoterrier/4.x-dev
diosmosis Oct 5, 2020
22baad5
Merge pull request #276 from matomo-org/maxheaders
diosmosis Oct 5, 2020
1e6f71b
Extra host from CloudFront x-host-header
cristiklein Nov 4, 2020
e7e2d7d
When printing response in an error message, make sure were using a st…
diosmosis Nov 6, 2020
2299a42
Merge pull request #284 from matomo-org/bytes-to-str
tsteur Nov 8, 2020
05b71f3
Fix importing compressed log files
sgiehl Nov 17, 2020
ee822ac
improve tests
sgiehl Nov 18, 2020
272608f
explicitly sort glob results for an implicit progress bar, fixes #291
Prinzhorn Nov 18, 2020
04657aa
Merge pull request #292 from Prinzhorn/sorted-glob
sgiehl Nov 18, 2020
c35ff66
enrich changelog
sgiehl Nov 18, 2020
85b9e5d
Merge pull request #288 from matomo-org/fixarchiveimport
diosmosis Nov 19, 2020
d9d8ead
Merge pull request #283 from cristiklein/cloudfront-fix-host
sgiehl Nov 30, 2020
1930510
Change command to re-archive.
diosmosis Dec 21, 2020
7861399
Merge pull request #296 from matomo-org/change-recommended-command
sgiehl Dec 23, 2020
4e59be6
Merge branch '4.x-dev' into php-binary
sgiehl Feb 2, 2021
a17ef35
fixed typo
sgiehl Feb 2, 2021
a12e27f
Merge pull request #244 from domsson/php-binary
diosmosis Feb 3, 2021
a821226
Remove colons from timezone
mwithheld Mar 4, 2021
fa63c93
Merge pull request #308 from mwithheld/patch-1
sgiehl Apr 22, 2021
1702ed3
Reports signature files as downloads
Pierre-Lannoy May 26, 2021
f0603a3
Merge pull request #313 from Pierre-Lannoy/patch-2
sgiehl May 26, 2021
0e36ae9
Add Gandi VirtualHost log format
Jun 24, 2021
9a0e983
Fix --output option
sgiehl Jun 24, 2021
e202d3d
Fix variable name + addition of unit tests for "Gandi" format
Jun 25, 2021
1ca1d9e
Bug (on a Gandhi virtualhost) on the JSON response of the HTTP reques…
Jun 25, 2021
c9bf980
Merge pull request #317 from matomo-org/fixoutputoption
diosmosis Jun 27, 2021
1255b71
Improvement of the RegEx of the Gandi format
tups Jun 28, 2021
9209c7d
Refactor RegEx Gandi for consistent with the other regexes
Jun 28, 2021
b9f5e1e
Merge pull request #316 from tups/4.x-dev
diosmosis Jun 28, 2021
6a0dae6
mention Gandi's virtualhost servers in support log formats
mattab Jul 27, 2021
2e5e26f
Fix disabling of queued tracking with bulk requests.
EreMaijala Nov 16, 2021
55eb9b1
Merge pull request #324 from EreMaijala/fix-disable-queued-tracking
sgiehl Nov 18, 2021
76b121f
Mention Matomo for WordPress isn't compatible
tsteur Nov 30, 2021
6f9c05d
Merge pull request #327 from matomo-org/mla325
sgiehl Dec 1, 2021
e890d8b
test in newer python versions
Findus23 Jan 21, 2022
be792b2
Merge pull request #329 from matomo-org/test-more-python-versions
sgiehl Jan 21, 2022
58aa5cf
Run tests as github action
sgiehl Jan 21, 2022
b242bf3
use the github action instead of travis ci
sgiehl Jan 21, 2022
6f66f96
Merge pull request #330 from matomo-org/githubaction
sgiehl Jan 21, 2022
33ba655
Set referrer to empty if it doesn't exist
kuzi-moto May 16, 2022
fa17337
Merge pull request #336 from kuzi-moto/referrer_fix
sgiehl May 16, 2022
2ac9ad4
Update test action (#359)
sgiehl Sep 6, 2023
04bf501
Add Traefik json log support (#358)
sethlinnkuleuven Sep 7, 2023
f43877b
fix nginx format detection
sgiehl Oct 6, 2023
73a23df
Add Caddy json log support
simon04 Dec 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Tests

on:
pull_request:
push:
branches: [ 4.x-dev ]

permissions:
actions: read
checks: read
contents: read
deployments: none
issues: read
packages: none
pull-requests: read
repository-projects: none
security-events: none
statuses: none

jobs:
build:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
python-version: [ '3.7', '3.8', '3.9', '3.10' ]
operating-system: [ 'ubuntu-latest' ]
include:
- python-version: 3.5
operating-system: ubuntu-20.04
- python-version: 3.6
operating-system: ubuntu-20.04
name: Tests (Python ${{ matrix.python-version }})
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Pytest
run: |
pip install --upgrade pip
pip install pytest
python --version ; pip --version ; pytest --version
shell: bash
- name: Run Tests
run: |
cd tests
./run_tests.sh
shell: bash
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Changelog

## Version 4.0.0

- Process file globs in a sorted order (#291)
- Use new performance metric for server generation time (#260)
- Support for AWS Application and Elastic Load Balancer log formats (#280)
- Always disable queued tracking when sending requests from log import (#274)
- added support for Python 3.5 and above (#267)
- dropped support for Python 2.x (#267)
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ Import your server logs in Matomo with this powerful and easy to use tool.

## Requirements

* Python 2.6 or 2.7. Python 3.x is not supported.
* Matomo >= 2.14.0
* Python 3.5, 3.6, 3.7, 3.8, 3.9, 3.10.
* Matomo On-Premise >= 4.0.0 or Matomo Cloud. Doesn't work when [Matomo for WordPress](https://wordpress.org/plugins/matomo/) is used.

Build status (master branch) [![Build Status](https://travis-ci.org/matomo-org/matomo-log-analytics.svg?branch=master)](https://travis-ci.org/matomo-org/matomo-log-analytics)
Build status (main branch) ![PHPUnit](https://github.com/matomo-org/matomo-log-analytics/workflows/Tests/badge.svg?branch=4.x-dev)

## Supported log formats


The script will import all standard web server log files, and some files with non-standard formats. The following log formats are supported:
* all default log formats for: Nginx, Apache, IIS, Tomcat
* all log formats commonly used such as: NCSA Common log format, Extended log format, W3C Extended log files, Nginx JSON, OVH
* all default log formats for: Nginx, Apache, IIS, Tomcat, Haproxy
* all log formats commonly used such as: NCSA Common log format, Extended log format, W3C Extended log files, Nginx JSON, OVH, Gandi virtualhost servers
* log files of some popular Cloud services: Amazon AWS CloudFront logs, AWS S3 logs, AWS ELB logs.
* streaming media server log files such as: Icecast
* log files with and without the virtual host will be imported
Expand All @@ -30,7 +30,7 @@ We're looking for contributors! Feel free to submit Pull requests on Github.
The Log Analytics importer is designed to detect and import into Matomo as many log files as possible. Help us add your log formats!

* Implement your new log format in the import_logs.py file (look for `FORMATS = {` variable where the log formats are defined),
* Add a new test in [tests/tests.py](https://github.com/matomo-org/matomo-log-analytics/blob/master/tests/tests.py),
* Add a new test in [tests/test_main.py](https://github.com/matomo-org/matomo-log-analytics/blob/4.x-dev/tests/test_main.py),
* Test that the logs are imported successfully as you expected (`tests/run_tests.sh`),
* Open a Pull Request,
* Check the test you have added works (the build should be green),
Expand Down Expand Up @@ -71,7 +71,7 @@ If you wish to track all requests the following command would be used:
log importer interprets the field correctly.

* Some log formats can't be detected automatically as they would conflict with other formats. In order to import those logfiles make sure to specify the `--log-format-name` option.
Those log formats are: OVH
Those log formats are: OVH (ovh), Incapsula W3C (incapsula_w3c)

## How to import your logs automatically every day?

Expand Down Expand Up @@ -234,7 +234,7 @@ Just needed to configure the best params for import_logs.py, file `/usr/local/ma

##### Example of regex for syslog format (centralized logs)

###### log format exemple
###### log format example

```
Aug 31 23:59:59 tt-srv-name www.tt.com: 1.1.1.1 - - [31/Aug/2014:23:59:59 +0200] "GET /index.php HTTP/1.0" 200 3838 "http://www.tt.com/index.php" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0" 365020 www.tt.com
Expand Down
Loading