You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by br...@apache.org on 2015/07/23 06:01:52 UTC

[1/5] trafficserver git commit: TS-3780: Logs_xml: add logging field for incoming (interface) ip.

Repository: trafficserver
Updated Branches:
  refs/heads/master 404e7866b -> b2b004066


TS-3780: Logs_xml: add logging field for incoming (interface) ip.


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/063cb576
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/063cb576
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/063cb576

Branch: refs/heads/master
Commit: 063cb576a753d75dc43f55b0a8438b59e90cc08b
Parents: bb6f9f3
Author: Zizhong Zhang <zi...@linkedin.com>
Authored: Mon Jul 20 22:41:08 2015 -0700
Committer: Zizhong Zhang <zi...@linkedin.com>
Committed: Mon Jul 20 22:41:08 2015 -0700

----------------------------------------------------------------------
 proxy/logging/Log.cc           | 11 +++++++++++
 proxy/logging/LogAccess.cc     |  5 +++++
 proxy/logging/LogAccess.h      |  9 +++++----
 proxy/logging/LogAccessHttp.cc |  6 ++++++
 proxy/logging/LogAccessHttp.h  |  1 +
 5 files changed, 28 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/063cb576/proxy/logging/Log.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc
index 01921f4..6f20b46 100644
--- a/proxy/logging/Log.cc
+++ b/proxy/logging/Log.cc
@@ -344,7 +344,18 @@ Log::init_fields()
     new LogField("client_host_ip_hex", "chih", LogField::IP, &LogAccess::marshal_client_host_ip, &LogAccess::unmarshal_ip_to_hex);
   global_field_list.add(field, false);
   ink_hash_table_insert(field_symbol_hash, "chih", field);
+  
+  // interface ip 
 
+  field = new LogField("host_interface_ip", "hii", LogField::IP, &LogAccess::marshal_host_interface_ip, &LogAccess::unmarshal_ip_to_str);
+  global_field_list.add(field, false);
+  ink_hash_table_insert(field_symbol_hash, "hii", field);
+
+  field =
+    new LogField("host_interface_ip_hex", "hiih", LogField::IP, &LogAccess::marshal_host_interface_ip, &LogAccess::unmarshal_ip_to_hex);
+  global_field_list.add(field, false);
+  ink_hash_table_insert(field_symbol_hash, "hiih", field);
+  // interface ip end
   field = new LogField("client_auth_user_name", "caun", LogField::STRING, &LogAccess::marshal_client_auth_user_name,
                        (LogField::UnmarshalFunc) & LogAccess::unmarshal_str);
   global_field_list.add(field, false);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/063cb576/proxy/logging/LogAccess.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogAccess.cc b/proxy/logging/LogAccess.cc
index bea3b1b..012ec2a 100644
--- a/proxy/logging/LogAccess.cc
+++ b/proxy/logging/LogAccess.cc
@@ -92,6 +92,11 @@ LogAccess::marshal_client_host_ip(char *buf)
   DEFAULT_IP_FIELD;
 }
 
+int
+LogAccess::marshal_host_interface_ip(char *buf)
+{
+  DEFAULT_IP_FIELD;
+}
 /*-------------------------------------------------------------------------
   -------------------------------------------------------------------------*/
 int

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/063cb576/proxy/logging/LogAccess.h
----------------------------------------------------------------------
diff --git a/proxy/logging/LogAccess.h b/proxy/logging/LogAccess.h
index 143aedf..61f6679 100644
--- a/proxy/logging/LogAccess.h
+++ b/proxy/logging/LogAccess.h
@@ -170,10 +170,11 @@ public:
   //
   // client -> proxy fields
   //
-  inkcoreapi virtual int marshal_client_host_ip(char *);        // STR
-  inkcoreapi virtual int marshal_client_host_port(char *);      // INT
-  inkcoreapi virtual int marshal_client_auth_user_name(char *); // STR
-  int marshal_client_req_timestamp_sec(char *);                 // INT
+  inkcoreapi virtual int marshal_client_host_ip(char *);                // STR
+  inkcoreapi virtual int marshal_host_interface_ip(char *);      // STR
+  inkcoreapi virtual int marshal_client_host_port(char *);              // INT
+  inkcoreapi virtual int marshal_client_auth_user_name(char *);         // STR
+  int marshal_client_req_timestamp_sec(char *);                         // INT
 
   inkcoreapi virtual int marshal_client_req_text(char *);               // STR
   inkcoreapi virtual int marshal_client_req_http_method(char *);        // STR

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/063cb576/proxy/logging/LogAccessHttp.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogAccessHttp.cc b/proxy/logging/LogAccessHttp.cc
index 8d457ab..4eedaa5 100644
--- a/proxy/logging/LogAccessHttp.cc
+++ b/proxy/logging/LogAccessHttp.cc
@@ -237,6 +237,12 @@ LogAccessHttp::marshal_client_host_ip(char *buf)
   return marshal_ip(buf, &m_http_sm->t_state.client_info.src_addr.sa);
 }
 
+int
+LogAccessHttp::marshal_host_interface_ip(char *buf)
+{
+  return marshal_ip(buf, &m_http_sm->t_state.client_info.dst_addr.sa);
+}
+
 /*-------------------------------------------------------------------------
   -------------------------------------------------------------------------*/
 int

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/063cb576/proxy/logging/LogAccessHttp.h
----------------------------------------------------------------------
diff --git a/proxy/logging/LogAccessHttp.h b/proxy/logging/LogAccessHttp.h
index 984794d..a228f31 100644
--- a/proxy/logging/LogAccessHttp.h
+++ b/proxy/logging/LogAccessHttp.h
@@ -56,6 +56,7 @@ public:
   // client -> proxy fields
   //
   virtual int marshal_client_host_ip(char *);                // STR
+  virtual int marshal_host_interface_ip(char *);             // STR
   virtual int marshal_client_host_port(char *);              // INT
   virtual int marshal_client_auth_user_name(char *);         // STR
   virtual int marshal_client_req_text(char *);               // STR


[3/5] trafficserver git commit: TS-3780: Logs_xml: add logging field for incoming (interface) ip. DOCUMENTATION

Posted by br...@apache.org.
TS-3780: Logs_xml: add logging field for incoming (interface) ip. DOCUMENTATION


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/727f6caa
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/727f6caa
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/727f6caa

Branch: refs/heads/master
Commit: 727f6caafb7d492e13c8d6360b958c67256a9dca
Parents: e399791
Author: Zizhong Zhang <zi...@linkedin.com>
Authored: Mon Jul 20 22:56:11 2015 -0700
Committer: Zizhong Zhang <zi...@linkedin.com>
Committed: Mon Jul 20 22:56:11 2015 -0700

----------------------------------------------------------------------
 doc/admin/event-logging-formats.en.rst | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/727f6caa/doc/admin/event-logging-formats.en.rst
----------------------------------------------------------------------
diff --git a/doc/admin/event-logging-formats.en.rst b/doc/admin/event-logging-formats.en.rst
index cdd7923..b390965 100644
--- a/doc/admin/event-logging-formats.en.rst
+++ b/doc/admin/event-logging-formats.en.rst
@@ -109,6 +109,16 @@ The following list describes Traffic Server custom logging fields.
 ``chih``
     The IP address of the client's host machine in hexadecimal.
 
+.. _hii:
+
+``hii``
+    This is the incoming (interface) ip for traffic server, in otherwords this is the ip address the client connected to.
+
+.. _hiih:
+
+``hiih``
+    The the incoming (interface) ip in hexadecimal.
+
 .. _chp:
 
 ``chp``


[2/5] trafficserver git commit: TS-3780: Logs_xml: add logging field for incoming (interface) ip. TESTS

Posted by br...@apache.org.
TS-3780: Logs_xml: add logging field for incoming (interface) ip. TESTS


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/e3997919
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/e3997919
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/e3997919

Branch: refs/heads/master
Commit: e39979197066c4e32cfee8dd6ca9301d4fbc02b3
Parents: 063cb57
Author: Zizhong Zhang <zi...@linkedin.com>
Authored: Mon Jul 20 22:45:16 2015 -0700
Committer: Zizhong Zhang <zi...@linkedin.com>
Committed: Mon Jul 20 22:45:16 2015 -0700

----------------------------------------------------------------------
 ci/tsqa/tests/test_custom_log.py | 71 +++++++++++++++++++++++++++++++++++
 1 file changed, 71 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e3997919/ci/tsqa/tests/test_custom_log.py
----------------------------------------------------------------------
diff --git a/ci/tsqa/tests/test_custom_log.py b/ci/tsqa/tests/test_custom_log.py
new file mode 100644
index 0000000..37573b7
--- /dev/null
+++ b/ci/tsqa/tests/test_custom_log.py
@@ -0,0 +1,71 @@
+'''
+Test custom log field
+'''
+
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+import os
+import requests
+import time
+import logging
+import SocketServer
+import random
+import tsqa.test_cases
+import helpers
+import json
+
+log = logging.getLogger(__name__)
+
+class TestCustomLogField(helpers.EnvironmentCase):
+    '''
+    Tests for a customed log field called hii
+    '''
+    @classmethod
+    def setUpEnv(cls, env):
+        
+        cls.configs['remap.config'].add_line(
+            'map / http://www.linkedin.com/ @action=deny'
+        )
+        cls.log_file_name = 'test_log_field'
+        cls.configs['records.config']['CONFIG'].update({
+          'proxy.config.log.custom_logs_enabled': 1,
+        })
+
+        cls.log_file_path = os.path.join(cls.environment.layout.prefix, 'var/log/test_log_field.log')
+        cls.log_etc_file = os.path.join(cls.environment.layout.prefix, 'etc/trafficserver/logs_xml.config')
+        cls.configs['logs_xml.config'].add_line('<LogFormat><Name = "testlogfield"/><Format = "%<hii> %<hiih>"/></LogFormat>')
+        cls.configs['logs_xml.config'].add_line('<LogObject><Format = "testlogfield"/><Filename = "test_log_field"/><Mode = "ascii"/></LogObject>')
+
+    def ip_to_hex(self, ipstr):
+      num_list = ipstr.split('.')
+      int_value = (int(num_list[0]) << 24) + (int(num_list[1]) << 16) + (int(num_list[2]) << 8) + (int(num_list[3]))
+      return hex(int_value).upper()[2:]
+
+    def test_log_field(self):
+      random.seed()
+      times = 10
+      for i in xrange(times):
+        request_ip = "127.%d.%d.%d" % (random.randint(1, 255), random.randint(1, 255), random.randint(1, 255))
+        url = 'http://%s:%s' % (request_ip, self.configs['records.config']['CONFIG']['proxy.config.http.server_ports'])
+        r = requests.get(url)
+        #get the last line of the log file
+        time.sleep(10)
+        with open(self.log_file_path) as f:
+          for line in f:
+            pass
+        expected_line = "%s %s\n" % (request_ip, self.ip_to_hex(request_ip))
+        self.assertEqual(line, expected_line)


[5/5] trafficserver git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/trafficserver

Posted by br...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/trafficserver


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/b2b00406
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/b2b00406
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/b2b00406

Branch: refs/heads/master
Commit: b2b0040669818a3dc51b71617507b37e5d51d5c8
Parents: aa8170a 404e786
Author: Brian Geffon <br...@apache.org>
Authored: Wed Jul 22 21:01:19 2015 -0700
Committer: Brian Geffon <br...@apache.org>
Committed: Wed Jul 22 21:01:19 2015 -0700

----------------------------------------------------------------------
 iocore/cache/CacheDisk.cc                       |    1 +
 iocore/net/SSLNetVConnection.cc                 |  103 +-
 lib/raft/raft_impl.h                            | 1028 +++++++++---------
 lib/raft/test_makefile                          |   17 +
 .../ssl_cert_loader/ssl-cert-loader.cc          |    8 +-
 proxy/http2/test_Huffmancode.cc                 |   23 +
 proxy/spdy/SpdyClientSession.cc                 |    2 +-
 7 files changed, 610 insertions(+), 572 deletions(-)
----------------------------------------------------------------------



[4/5] trafficserver git commit: Merge branch 'customLog' of https://github.com/zizhong/trafficserver

Posted by br...@apache.org.
Merge branch 'customLog' of https://github.com/zizhong/trafficserver


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/aa8170a4
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/aa8170a4
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/aa8170a4

Branch: refs/heads/master
Commit: aa8170a4615fa1a721bd4295a3be1b6cb52a488d
Parents: db4029a 727f6ca
Author: Brian Geffon <br...@apache.org>
Authored: Wed Jul 22 21:00:30 2015 -0700
Committer: Brian Geffon <br...@apache.org>
Committed: Wed Jul 22 21:00:30 2015 -0700

----------------------------------------------------------------------
 ci/tsqa/tests/test_custom_log.py       | 71 +++++++++++++++++++++++++++++
 doc/admin/event-logging-formats.en.rst | 10 ++++
 proxy/logging/Log.cc                   | 11 +++++
 proxy/logging/LogAccess.cc             |  5 ++
 proxy/logging/LogAccess.h              |  9 ++--
 proxy/logging/LogAccessHttp.cc         |  6 +++
 proxy/logging/LogAccessHttp.h          |  1 +
 7 files changed, 109 insertions(+), 4 deletions(-)
----------------------------------------------------------------------