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

anonymous-piwik-user opened this Issue Nov 2, 2013 · 1 comment

2 participants


Importing our apache logs I get the following error:

Traceback (most recent call last):
  File "/var/alternc/html/a/analytics/piwik/misc/log-analytics/", line 1663, in <module>
  File "/var/alternc/html/a/analytics/piwik/misc/log-analytics/", line 1627, in main
  File "/var/alternc/html/a/analytics/piwik/misc/log-analytics/", 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/ b/misc/log-analytics/
index 56f28c1..dcbc770 100755
--- a/misc/log-analytics/
+++ b/misc/log-analytics/
@@ -1534,7 +1534,7 @@ class Parser(object):
             hit.ip = format.get('ip')
                 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


Piwik Open Source Analytics member

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