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
225 stars 118 forks source link

Make the --output option work again #317

Closed sgiehl closed 3 years ago

sgiehl commented 3 years ago

Description:

While writing some integration tests for Matomo and Log importer (see https://github.com/matomo-org/matomo/pull/17700) I realized that the --output option always results in a

Traceback (most recent call last):
  File "/srv/matomo/misc/log-analytics/import_logs.py", line 2667, in <module>
    config = Configuration()
  File "/srv/matomo/misc/log-analytics/import_logs.py", line 1029, in __init__
    self._parse_args(self._create_parser(), argv)
  File "/srv/matomo/misc/log-analytics/import_logs.py", line 939, in _parse_args
    sys.stdout = sys.stderr = open(self.options.output, 'a+', 0)
ValueError: can't have unbuffered text I/O

Guess that is a regression from python3 migration

Review