How to import an access log with multiple vhosts

I have configured one piwik site and I want to import an apache access log with multiple vhosts. Piwik should then count and show the requests for each vhost.

I added a new logformat to the import python script and run the import. the import seems to work, but I don’t see any statistics for individual vhosts. This is what I changed:

– snip (diff) –
< ‘(?P\S+) (?P[\w-.])(?::\d+)? \S+ \S+ [(?P.?) (?P.?)] '
< '"\S+ (?P.
?) \S+" (?P\S+) (?P\S+) “(?P.?)" "(?P<user_agent>.?)”’
< )
< ‘virtual’: RegexFormat(‘virtual’, _VIRTUAL_LOG_FORMAT),
– snip –

– snip apache log format –
LogFormat “%h %V %l %u %t “%r” %>s %b “%{Referer}i” “%{User-Agent}i”” virtual
– snip –

With this code change I can use the option --log-format-name=“virtual” and it does recognize my log format. please note, the second field in my access log is the field for the virtualhost name. this is the only difference between a common apache log and my logformat.

After doing some research I found a possible solution with custom variables and javascript import. But how can I archive something similiar with the python import script?