diff --git a/docker/images/davrods/apache2.conf b/docker/images/davrods/apache2.conf index 672b38428..71e682774 100644 --- a/docker/images/davrods/apache2.conf +++ b/docker/images/davrods/apache2.conf @@ -216,7 +216,7 @@ AccessFileName .htaccess # LogFormat "%{X-Forwarded-For}i %h %l %u %v %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined - LogFormat "%{X-Forwarded-For}i %h %l %u %v %t \"%r\" %>s %b" common + LogFormat "%{X-Forwarded-For}i %h %l %u %v %t \"%r\" %>s %b %D(%T)" common # You need to enable mod_logio.c to use %I and %O diff --git a/docker/images/yoda_eus/apache2.conf b/docker/images/yoda_eus/apache2.conf index 672b38428..71e682774 100644 --- a/docker/images/yoda_eus/apache2.conf +++ b/docker/images/yoda_eus/apache2.conf @@ -216,7 +216,7 @@ AccessFileName .htaccess # LogFormat "%{X-Forwarded-For}i %h %l %u %v %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined - LogFormat "%{X-Forwarded-For}i %h %l %u %v %t \"%r\" %>s %b" common + LogFormat "%{X-Forwarded-For}i %h %l %u %v %t \"%r\" %>s %b %D(%T)" common # You need to enable mod_logio.c to use %I and %O diff --git a/docker/images/yoda_portal/apache2.conf b/docker/images/yoda_portal/apache2.conf index 672b38428..71e682774 100644 --- a/docker/images/yoda_portal/apache2.conf +++ b/docker/images/yoda_portal/apache2.conf @@ -216,7 +216,7 @@ AccessFileName .htaccess # LogFormat "%{X-Forwarded-For}i %h %l %u %v %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined - LogFormat "%{X-Forwarded-For}i %h %l %u %v %t \"%r\" %>s %b" common + LogFormat "%{X-Forwarded-For}i %h %l %u %v %t \"%r\" %>s %b %D(%T)" common # You need to enable mod_logio.c to use %I and %O diff --git a/docker/images/yoda_public/apache2.conf b/docker/images/yoda_public/apache2.conf index 672b38428..71e682774 100644 --- a/docker/images/yoda_public/apache2.conf +++ b/docker/images/yoda_public/apache2.conf @@ -216,7 +216,7 @@ AccessFileName .htaccess # LogFormat "%{X-Forwarded-For}i %h %l %u %v %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined - LogFormat "%{X-Forwarded-For}i %h %l %u %v %t \"%r\" %>s %b" common + LogFormat "%{X-Forwarded-For}i %h %l %u %v %t \"%r\" %>s %b %D(%T)" common # You need to enable mod_logio.c to use %I and %O diff --git a/docker/images/yoda_web_mock/apache2.conf b/docker/images/yoda_web_mock/apache2.conf index 672b38428..71e682774 100644 --- a/docker/images/yoda_web_mock/apache2.conf +++ b/docker/images/yoda_web_mock/apache2.conf @@ -216,7 +216,7 @@ AccessFileName .htaccess # LogFormat "%{X-Forwarded-For}i %h %l %u %v %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined - LogFormat "%{X-Forwarded-For}i %h %l %u %v %t \"%r\" %>s %b" common + LogFormat "%{X-Forwarded-For}i %h %l %u %v %t \"%r\" %>s %b %D(%T)" common # You need to enable mod_logio.c to use %I and %O diff --git a/docs/administration/configuring-yoda.md b/docs/administration/configuring-yoda.md index 0bd92d7ed..89cea6a88 100644 --- a/docs/administration/configuring-yoda.md +++ b/docs/administration/configuring-yoda.md @@ -166,6 +166,7 @@ Variable | Description -----------------------------------|--------------------------------------------- httpd_log_forwarded_for | Whether to log X-Forwarded-For headers in Apache logs (boolean, default value: false). This logs source IP addresses of requests if requests to the Yoda web portal and/or WebDAV interface are routed via a load balancer. httpd_log_user_agent | Whether to log the user agent of browsers and WebDAV clients in the Apache logs (boolean, default value: false) +httpd_log_request_duration | Whether to log how much time it took to respond to web server requests (boolean, default value: false). Time is logged in both microseconds, and in seconds (rounded down). yoda_portal_log_api_call_duration | Whether to log duration and parameters of all API calls from the Yoda portal. This is mainly useful for performance testing (boolean, default value: false) diff --git a/roles/apache/defaults/main.yml b/roles/apache/defaults/main.yml index d5d98161d..07105f60a 100644 --- a/roles/apache/defaults/main.yml +++ b/roles/apache/defaults/main.yml @@ -3,3 +3,4 @@ yoda_enable_httpd: true httpd_log_forwarded_for: false httpd_log_user_agent: false +httpd_log_request_duration: false diff --git a/roles/apache/templates/main.conf.el7.j2 b/roles/apache/templates/main.conf.el7.j2 index 66ec0b7fb..7cae9f0bf 100644 --- a/roles/apache/templates/main.conf.el7.j2 +++ b/roles/apache/templates/main.conf.el7.j2 @@ -180,8 +180,9 @@ LogLevel warn {% set httpd_log_forwarded_for_fragment = "%{X-Forwarded-For}i " if httpd_log_forwarded_for else "" -%} {%- set httpd_log_user_agent_fragment = ' \\"%{User-Agent}i\\"' if httpd_log_user_agent else "" -%} + {%- set httpd_log_request_duration_fragment = " %D(%T)" if httpd_log_request_duration else "" -%} LogFormat "{{ httpd_log_forwarded_for_fragment }}%h %l %u %v %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined - LogFormat "{{ httpd_log_forwarded_for_fragment }}%h %l %u %v %t \"%r\" %>s %b {{ httpd_log_user_agent_fragment }}" common + LogFormat "{{ httpd_log_forwarded_for_fragment }}%h %l %u %v %t \"%r\" %>s %b {{ httpd_log_user_agent_fragment }}{{ httpd_log_request_duration_fragment }}" common # You need to enable mod_logio.c to use %I and %O diff --git a/roles/apache/templates/main.conf.focal.j2 b/roles/apache/templates/main.conf.focal.j2 index aa8a7242a..9bc40666e 100644 --- a/roles/apache/templates/main.conf.focal.j2 +++ b/roles/apache/templates/main.conf.focal.j2 @@ -218,8 +218,9 @@ AccessFileName .htaccess {% set httpd_log_forwarded_for_fragment = "%{X-Forwarded-For}i " if httpd_log_forwarded_for else "" -%} {%- set httpd_log_user_agent_fragment = ' \\"%{User-Agent}i\\"' if httpd_log_user_agent else "" -%} + {%- set httpd_log_request_duration_fragment = " %D(%T)" if httpd_log_request_duration else "" -%} LogFormat "{{ httpd_log_forwarded_for_fragment }}%h %l %u %v %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined - LogFormat "{{ httpd_log_forwarded_for_fragment }}%h %l %u %v %t \"%r\" %>s %b {{ httpd_log_user_agent_fragment }}" common + LogFormat "{{ httpd_log_forwarded_for_fragment }}%h %l %u %v %t \"%r\" %>s %b {{ httpd_log_user_agent_fragment }}{{ httpd_log_request_duration_fragment }}" common # You need to enable mod_logio.c to use %I and %O