diff options
author | Timo Besenreuther <timo.besenreuther@gmail.com> | 2013-04-02 16:40:45 +0400 |
---|---|---|
committer | Timo Besenreuther <timo.besenreuther@gmail.com> | 2013-04-02 16:40:45 +0400 |
commit | fb5f11a5ca82b15eb419803e6e00ce6dfba515d0 (patch) | |
tree | 48841d8b676426bc81729c1caa3304098a2dc91c /misc | |
parent | a05bd7ba73dbf53fbb2fb06dd3a927ae5ec167bc (diff) |
refs #1700 performance analytics
* adding avg_time_generation to Actions.get + integration tests
* adding sparkline for average generation time to Visitors > Overview
* changing number formatting to 0.XXs instead of XXXms + test cases
* tooltip for reports with avg. generation time: "average based on X hit(s)"
* log import: support generation_time_milli (not only generation_time_micro)
* example for importing generation time from logs in read me
Diffstat (limited to 'misc')
-rw-r--r-- | misc/log-analytics/README.md | 10 | ||||
-rwxr-xr-x | misc/log-analytics/import_logs.py | 9 |
2 files changed, 16 insertions, 3 deletions
diff --git a/misc/log-analytics/README.md b/misc/log-analytics/README.md index 13b8a0ea87..09dc2b623d 100644 --- a/misc/log-analytics/README.md +++ b/misc/log-analytics/README.md @@ -175,3 +175,13 @@ This log format can be specified for nginx access logs to capture multiple virtu * access_log /PATH/TO/access.log vhosts; When executing import_logs.py specify the "common_complete" format. + + +## Import Generation Time + +Apache can log the generation time in microseconds using %D in the LogFormat. +This metric can be imported using a custom log format in this script, which means that you have to specify a --log-format-regex parameter that contains the group generation_time_micro. + +Here's an example: +Apache LogFormat "%h %l %u %t \"%r\" %>s %b %D" +--log-format-regex="(?P<ip>\S+) \S+ \S+ \[(?P<date>.*?) (?P<timezone>.*?)\] \"\S+ (?P<path>.*?) \S+\" (?P<status>\S+) (?P<length>\S+) (?P<generation_time_micro>\S+)"
\ No newline at end of file diff --git a/misc/log-analytics/import_logs.py b/misc/log-analytics/import_logs.py index 785c6c69dc..3be72a186c 100755 --- a/misc/log-analytics/import_logs.py +++ b/misc/log-analytics/import_logs.py @@ -1437,11 +1437,14 @@ class Parser(object): except (ValueError, IndexError): # Some lines or formats don't have a length (e.g. 304 redirects, IIS logs) hit.length = 0 - + try: - hit.generation_time_milli = int(match.group('generation_time_micro')) / 1000 + hit.generation_time_milli = int(match.group('generation_time_milli')) except IndexError: - hit.generation_time_milli = 0 + try: + hit.generation_time_milli = int(match.group('generation_time_micro')) / 1000 + except IndexError: + hit.generation_time_milli = 0 if config.options.log_hostname: hit.host = config.options.log_hostname |