From f5fac8b2459722a2203c46020149dbdf4130262f Mon Sep 17 00:00:00 2001 From: Harry Danes Date: Fri, 18 Apr 2014 11:57:31 +0200 Subject: [PATCH] Introduced log_by_lua and log_by_lua_file params. --- manifests/resource/vhost.pp | 22 ++++++++++++++++++---- templates/vhost/vhost_header.erb | 8 ++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/manifests/resource/vhost.pp b/manifests/resource/vhost.pp index 0d6241a21..0421fd864 100644 --- a/manifests/resource/vhost.pp +++ b/manifests/resource/vhost.pp @@ -98,14 +98,20 @@ # [*vhost_cfg_ssl_prepend*] - It expects a hash with custom directives to # put before everything else inside vhost ssl # [*rewrite_to_https*] - Adds a server directive and rewrite rule to -# rewrite to ssl +# rewrite to ssl # [*include_files*] - Adds include files to vhost # [*access_log*] - Where to write access log. May add additional -# options like log format to the end. +# options like log format to the end. # [*error_log*] - Where to write error log. May add additional -# options like error level to the end. +# options like error level to the end. # [*passenger_cgi_param*] - Allows one to define additional CGI environment -# variables to pass to the backend application +# variables to pass to the backend application +# [*log_by_lua*] - Run the Lua source code inlined as the +# at the log request processing phase. +# This does not replace the current access logs, but runs after. +# [*log_by_lua_file*] - Equivalent to log_by_lua, except that the file +# specified by contains the Lua code, or, as from +# the v0.5.0rc32 release, the Lua/LuaJIT bytecode to be executed. # Actions: # # Requires: @@ -183,6 +189,8 @@ $error_log = undef, $format_log = undef, $passenger_cgi_param = undef, + $log_by_lua = undef, + $log_by_lua_file = undef, $use_default_location = true, $rewrite_rules = [], ) { @@ -314,6 +322,12 @@ if ($passenger_cgi_param != undef) { validate_hash($passenger_cgi_param) } + if ($log_by_lua != undef) { + validate_string($log_by_lua) + } + if ($log_by_lua_file != undef) { + validate_string($log_by_lua_file) + } validate_bool($use_default_location) validate_array($rewrite_rules) diff --git a/templates/vhost/vhost_header.erb b/templates/vhost/vhost_header.erb index 8fd7615ae..11f93305c 100644 --- a/templates/vhost/vhost_header.erb +++ b/templates/vhost/vhost_header.erb @@ -48,6 +48,14 @@ server { <% if @index_files.count > 0 -%> index <% Array(@index_files).each do |i| %> <%= i %><% end %>; <% end -%> +<% if defined? @log_by_lua -%> + log_by_lua '<%= @log_by_lua %>'; +<% end -%> +<% if defined? @log_by_lua_file -%> + log_by_lua_file "<%= @log_by_lua_file %>"; +<% end -%> + + access_log <%= @access_log_real %>; error_log <%= @error_log_real %>;