Merge "Add http_client_ip_address field for Apache WSGI logging"
diff --git a/heka/files/lua/decoders/apache_wsgi_log.lua b/heka/files/lua/decoders/apache_wsgi_log.lua
index a40b609..e35b1ed 100644
--- a/heka/files/lua/decoders/apache_wsgi_log.lua
+++ b/heka/files/lua/decoders/apache_wsgi_log.lua
@@ -66,6 +66,9 @@
                 msg.Fields.http_response_time = msg.Fields.http_response_time / 1e6
             end
         end
+        if m.http_x_forwarded_for and patt.ip_address:match(m.http_x_forwarded_for) then
+            msg.Fields.http_client_ip_address = m.http_x_forwarded_for
+        end
 
         local request = m.request
         m = request_grammar:match(request)
diff --git a/heka/files/lua/decoders/keystone_wsgi_log.lua b/heka/files/lua/decoders/keystone_wsgi_log.lua
index 8ed9551..8cdc523 100644
--- a/heka/files/lua/decoders/keystone_wsgi_log.lua
+++ b/heka/files/lua/decoders/keystone_wsgi_log.lua
@@ -66,6 +66,9 @@
                 msg.Fields.http_response_time = msg.Fields.http_response_time / 1e6
             end
         end
+        if m.http_x_forwarded_for and patt.ip_address:match(m.http_x_forwarded_for) then
+            msg.Fields.http_client_ip_address = m.http_x_forwarded_for
+        end
 
         local request = m.request
         m = request_grammar:match(request)