From 22292022bce140d4e409ff8cdf980e59f91b0480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Droz?= Date: Fri, 16 Oct 2015 00:19:07 -0300 Subject: [PATCH] Ability to configure Apache access_log field number --- plugins/apache/apache_average_time_last_n_requests | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/apache/apache_average_time_last_n_requests b/plugins/apache/apache_average_time_last_n_requests index 709d43e0..f01bb638 100755 --- a/plugins/apache/apache_average_time_last_n_requests +++ b/plugins/apache/apache_average_time_last_n_requests @@ -1,5 +1,4 @@ #!/usr/bin/perl -w -# $Id$ # Author: Nicolas Mendoza - 2008-06-18 # # Monitors the average time requests matching a custom regexp takes @@ -16,12 +15,16 @@ # For instance: # LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\" %T %v" # Check http://httpd.apache.org/docs/2.2/mod/mod_log_config.html#formats for more info +# +# Configurable variables +# fieldno - Override the default field number +#%# family=auto use strict; my $LAST_N_REQUESTS = 100000; # calculate based on this amount of requests my $ACCESS_LOG_PATTERN = '/var/log/apache2/access.log.*'; # log pattern, if many it will take the last one. -my $TIME_FIELD_INDEX = -2; # second last field +my $TIME_FIELD_INDEX = exists $ENV{'fieldno'} ? $ENV{'fieldno'} : -2; # second last field my $config =<< "CONFIG" graph_title Apache average seconds last $LAST_N_REQUESTS requests