I plan to use the Python log import script to import Apache logs. I want to import only lines that contain a custom parameter (I’ll call it ‘username’ for the sake of this example).
(1) Can I SKIP importing any lines that don’t include the username parameter?
(2) Can I assign the username parameter to a piwik custom variable (for later use in various reports)?
--exclude-path=EXCLUDED_PATHS
Paths to exclude. Can be specified multiple times
--exclude-path-from=EXCLUDE_PATH_FROM
Each line from this file is a path to exclude
--include-path=INCLUDED_PATHS
Paths to include. Can be specified multiple times. If
not specified, all paths are included.
--include-path-from=INCLUDE_PATH_FROM
Each line from this file is a path to include
I’m not sure if they match only the path or also the query string. Where is your custom param specified?
Here is one line from the log, though I’ve obscured a few peripheral details.
nnn.nnn.nnn.nnn - - [19/May/2014:22:37:53 -0700] "GET /path/to/subdirectory/ HTTP/1.1" 200 22179 "http://members.domainobscured.com/path/subdirectory/" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3; Tablet PC 2.0)" i=annamaria64770:2cf7cf5cccbb69c73f49e56aa8364a5a; t=annamaria64770:2cf7cf5cccbb69c73f49e56aa8364a5a
The “t” parameter is one I’m interested in. A cgi script reads it from a first party cookie, makes it into an environment variable to be picked up by Apache for the purposes of putting it in the log as a custom parameter. Unfortunately I don’t see how the –exclude-path switch would help me.
I’m willing to solve this problem and propose a solution, although at this point I’m completely new to your log import script.
Matt, I’m a developer but new to Piwik. I’ll look at how you did this sort of thing for “Page generation time” and how custom variables are managed and I’ll try to do this for myself first. Do you suggest I add a ticket anyway?
I’ve added a new feature request ticket. I’m looking at the code this week, hoping I can solve this myself. I’ll post to Trak if I make progress. Thanks, Matt.