You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by yu...@apache.org on 2013/08/28 10:58:14 UTC

git commit: TS-2162: Auto-created collation LogObject would be misused by access log

Updated Branches:
  refs/heads/master 0aacb42a8 -> c7d8e1a5f


TS-2162: Auto-created collation LogObject would be misused by access log

When collation host receives LogBuffer data from network, it'll create
LogObject according the data's format automatically.

Since the LogFilter of these auto-created LogObjects are empty, they
will be misused by access log generated by collation host itself –
toss_this_entry() will always return false when m_does_conjunction is
set.

This patch introduces a new member variable: m_auto_created in LogObject,
so that we can distinguish this type of LogObject to avoid misusing.

Signed-off-by: Yunkai Zhang <qi...@taobao.com>


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

Branch: refs/heads/master
Commit: c7d8e1a5fc5a74aa683051e66974013a22f8d674
Parents: 0aacb42
Author: Yunkai Zhang <qi...@taobao.com>
Authored: Wed Aug 28 11:39:56 2013 +0800
Committer: Yunkai Zhang <qi...@taobao.com>
Committed: Wed Aug 28 16:57:51 2013 +0800

----------------------------------------------------------------------
 proxy/logging/Log.cc       |  2 +-
 proxy/logging/LogObject.cc |  4 +++-
 proxy/logging/LogObject.h  | 11 ++++++++++-
 3 files changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c7d8e1a5/proxy/logging/Log.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc
index 790bc04..2d9562c 100644
--- a/proxy/logging/Log.cc
+++ b/proxy/logging/Log.cc
@@ -1513,7 +1513,7 @@ Log::match_logobject(LogBufferHeader * header)
                               Log::config->collation_preproc_threads,
                               Log::config->rolling_interval_sec,
                               Log::config->rolling_offset_hr,
-                              Log::config->rolling_size_mb));
+                              Log::config->rolling_size_mb, true));
 
       obj->set_remote_flag();
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c7d8e1a5/proxy/logging/LogObject.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogObject.cc b/proxy/logging/LogObject.cc
index 29f1a39..ff7418d 100644
--- a/proxy/logging/LogObject.cc
+++ b/proxy/logging/LogObject.cc
@@ -76,7 +76,9 @@ LogObject::LogObject(LogFormat *format, const char *log_dir,
                      const char *basename, LogFileFormat file_format,
                      const char *header, int rolling_enabled,
                      int flush_threads, int rolling_interval_sec,
-                     int rolling_offset_hr, int rolling_size_mb):
+                     int rolling_offset_hr, int rolling_size_mb,
+                     bool auto_created):
+      m_auto_created(auto_created),
       m_alt_filename (NULL),
       m_flags (0),
       m_signature (0),

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c7d8e1a5/proxy/logging/LogObject.h
----------------------------------------------------------------------
diff --git a/proxy/logging/LogObject.h b/proxy/logging/LogObject.h
index b296f81..1f19b4f 100644
--- a/proxy/logging/LogObject.h
+++ b/proxy/logging/LogObject.h
@@ -101,7 +101,7 @@ public:
                  LogFileFormat file_format, const char *header,
                  int rolling_enabled, int flush_threads,
                  int rolling_interval_sec = 0, int rolling_offset_hr = 0,
-                 int rolling_size_mb = 0);
+                 int rolling_size_mb = 0, bool auto_created = false);
   LogObject(LogObject &);
   virtual ~LogObject();
 
@@ -198,6 +198,7 @@ public:
   int do_filesystem_checks();
 
 public:
+  bool m_auto_created;
   LogFormat * m_format;
   LogFile *m_logFile;
   LogFilterList m_filter_list;
@@ -406,6 +407,14 @@ LogObjectManager::log(LogAccess * lad)
 {
   int ret = 0;
   for (size_t i = 0; i < _numObjects; i++) {
+    //
+    // Auto created LogObject is only applied to LogBuffer
+    // data received from network in collation host. It should
+    // be ignored here.
+    //
+    if (_objects[i]->m_auto_created)
+      continue;
+
     ret |= _objects[i]->log(lad);
   }
   return ret;