Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

import_logs.py: ValueError: invalid literal for int() with base 10: '-' #4267

Closed
anonymous-piwik-user opened this Issue · 1 comment

2 participants

@anonymous-piwik-user

Importing our apache logs I get the following error:

Traceback (most recent call last):
  File "/var/alternc/html/a/analytics/piwik/misc/log-analytics/import_logs.py", line 1663, in <module>
    main()
  File "/var/alternc/html/a/analytics/piwik/misc/log-analytics/import_logs.py", line 1627, in main
    parser.parse(filename)
  File "/var/alternc/html/a/analytics/piwik/misc/log-analytics/import_logs.py", line 1536, in parse
    hit.length = int(str(format.get('length')))
ValueError: invalid literal for int() with base 10: '-'

Here is an easy fix:

diff --git a/misc/log-analytics/import_logs.py b/misc/log-analytics/import_logs.py
index 56f28c1..dcbc770 100755
--- a/misc/log-analytics/import_logs.py
+++ b/misc/log-analytics/import_logs.py
@@ -1534,7 +1534,7 @@ class Parser(object):
             hit.ip = format.get('ip')
             try:
                 hit.length = int(format.get('length'))
-            except BaseFormatException:
+            except:
                 # Some lines or formats don't have a length (e.g. 304 redirects, IIS logs)
                 hit.length = 0

Thanks

@mattab
Owner

Fixed in master, thanks for the report!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.