From f04a64aada10cc234ce9bc21dc1600bd96ae163d Mon Sep 17 00:00:00 2001 From: gau1991 Date: Thu, 9 Jul 2015 17:55:57 +0530 Subject: [PATCH] Added rt_cache_redis log format for redis --- ee/cli/plugins/site_functions.py | 8 ++++++++ ee/cli/plugins/stack.py | 8 ++++++++ ee/cli/templates/virtualconf.mustache | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ee/cli/plugins/site_functions.py b/ee/cli/plugins/site_functions.py index 294431db..ecf3c825 100644 --- a/ee/cli/plugins/site_functions.py +++ b/ee/cli/plugins/site_functions.py @@ -661,6 +661,14 @@ def site_package_check(self, stype): " server 127.0.0.1:6379;\n" " keepalive 10;\n}") + if os.path.isfile("/etc/nginx/nginx.conf") and (not + os.path.isfile("/etc/nginx/conf.d/redis.conf")): + with open("/etc/nginx/conf.d/redis.conf", "a") as redis_file: + redis_file.write("# Log format Settings\n" + "log_format rt_cache_redis '$remote_addr $upstream_response_time $srcache_fetch_status [$time_local] '\n" + "'$http_host \"$request\" $status $body_bytes_sent '\n" + "'\"$http_referer\" \"$http_user_agent\"';\n") + if self.app.pargs.hhvm: if platform.architecture()[0] is '32bit': Log.error(self, "HHVM is not supported by 32bit system") diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index 4cc2d7c2..ebb287af 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -559,6 +559,14 @@ class EEStackController(CementBaseController): " server 127.0.0.1:6379;\n" " keepalive 10;\n}\n") + if os.path.isfile("/etc/nginx/nginx.conf") and (not + os.path.isfile("/etc/nginx/conf.d/redis.conf")): + with open("/etc/nginx/conf.d/redis.conf", "a") as redis_file: + redis_file.write("# Log format Settings\n" + "log_format rt_cache_redis '$remote_addr $upstream_response_time $srcache_fetch_status [$time_local] '\n" + "'$http_host \"$request\" $status $body_bytes_sent '\n" + "'\"$http_referer\" \"$http_user_agent\"';\n") + if set(EEVariables.ee_php).issubset(set(apt_packages)): # Create log directories if not os.path.exists('/var/log/php5/'): diff --git a/ee/cli/templates/virtualconf.mustache b/ee/cli/templates/virtualconf.mustache index c422fab8..71341373 100644 --- a/ee/cli/templates/virtualconf.mustache +++ b/ee/cli/templates/virtualconf.mustache @@ -13,7 +13,7 @@ server { #server_name_in_redirect off; {{/multisite}} - access_log /var/log/nginx/{{site_name}}.access.log {{^static}}rt_cache{{/static}}; + access_log /var/log/nginx/{{site_name}}.access.log {{^wpredis}}{{^static}}rt_cache{{/static}}{{/wpredis}}{{#wpredis}}rt_cache_redis{{/wpredis}}; error_log /var/log/nginx/{{site_name}}.error.log; {{#proxy}}