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/29 15:19:47 UTC
git commit: TS-2145: Add metrics for log collation
Updated Branches:
refs/heads/master d60628cd8 -> 9d2acd0a5
TS-2145: Add metrics for log collation
Without accurate stats, we don't known whether the log is lost.
This patch is used to verify, such as:
1) At log client side, how many logs genterated from HttpSM, how many
logs sent to LogServer.
2) At log server side, how many logs received from LogClient, how many
logs written to LogServers's disk.
After apply this patch, we will get the following metrics for logging:
a) Events of Log::error():
proxy.process.log.event_log_error_ok
proxy.process.log.event_log_error_skip
proxy.process.log.event_log_error_aggr
proxy.process.log.event_log_error_full
proxy.process.log.event_log_error_fail
b) Events for Log::access():
proxy.process.log.event_log_access_ok
proxy.process.log.event_log_access_skip
proxy.process.log.event_log_access_aggr
proxy.process.log.event_log_access_full
proxy.process.log.event_log_access_fail
c) Logging Data to/from network/disk:
proxy.process.log.num_sent_to_network
proxy.process.log.num_received_from_network
proxy.process.log.num_flush_to_disk
proxy.process.log.bytes_sent_to_network
proxy.process.log.bytes_received_from_network
proxy.process.log.bytes_flush_to_disk
proxy.process.log.bytes_written_to_disk
d) Mix:
proxy.process.log.log_files_open
proxy.process.log.log_files_space_used
BTW: Remove LOG_XXX stats macro according Leif's suggestion.
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/9d2acd0a
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/9d2acd0a
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/9d2acd0a
Branch: refs/heads/master
Commit: 9d2acd0a524d7d74cc41dc280c28a67b9eb72405
Parents: d60628c
Author: Yunkai Zhang <qi...@taobao.com>
Authored: Mon Aug 26 14:56:25 2013 +0800
Committer: Yunkai Zhang <qi...@taobao.com>
Committed: Thu Aug 29 20:57:07 2013 +0800
----------------------------------------------------------------------
proxy/InkAPI.cc | 1 +
proxy/logging/Log.cc | 86 +++++++--
proxy/logging/Log.h | 9 +-
proxy/logging/LogAccess.cc | 4 +-
proxy/logging/LogCollationClientSM.cc | 6 +
proxy/logging/LogCollationHostSM.cc | 11 +-
proxy/logging/LogConfig.cc | 299 +++++++++++++++--------------
proxy/logging/LogConfig.h | 59 +++---
proxy/logging/LogFile.cc | 33 +++-
proxy/logging/LogObject.cc | 63 ++++--
proxy/logging/LogObject.h | 18 --
11 files changed, 347 insertions(+), 242 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9d2acd0a/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index ba36120..b1c6416 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -6796,6 +6796,7 @@ TSTextLogObjectWrite(TSTextLogObject the_object, const char *format, ...)
switch (((TextLogObject *) the_object)->va_write(format, ap)) {
case (Log::LOG_OK):
case (Log::SKIP):
+ case (Log::AGGR):
break;
case (Log::FULL):
retVal = TS_ERROR;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9d2acd0a/proxy/logging/Log.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc
index 2d9562c..ec3c7ca 100644
--- a/proxy/logging/Log.cc
+++ b/proxy/logging/Log.cc
@@ -238,7 +238,7 @@ Log::periodic_tasks(long time_now)
Debug("log-config", "Performing reconfiguration, init status = %d", init_status);
if (logging_mode_changed) {
- int val = (int) LOG_ConfigReadInteger("proxy.config.log.logging_enabled");
+ int val = (int) REC_ConfigReadInteger("proxy.config.log.logging_enabled");
if (val<LOG_NOTHING || val> FULL_LOGGING) {
logging_mode = FULL_LOGGING;
@@ -966,7 +966,7 @@ Log::init(int flags)
if (config_flags & STANDALONE_COLLATOR) {
logging_mode = LOG_TRANSACTIONS_ONLY;
} else {
- int val = (int) LOG_ConfigReadInteger("proxy.config.log.logging_enabled");
+ int val = (int) REC_ConfigReadInteger("proxy.config.log.logging_enabled");
if (val < LOG_NOTHING || val > FULL_LOGGING) {
logging_mode = FULL_LOGGING;
Warning("proxy.config.log.logging_enabled has an invalid "
@@ -981,8 +981,12 @@ Log::init(int flags)
// be able to handle a logging mode change
//
if (!(config_flags & NO_REMOTE_MANAGEMENT)) {
- LOG_RegisterConfigUpdateFunc("proxy.config.log.logging_enabled", &Log::handle_logging_mode_change, NULL);
- LOG_RegisterLocalUpdateFunc("proxy.local.log.collation_mode", &Log::handle_logging_mode_change, NULL);
+
+ REC_RegisterConfigUpdateFunc("proxy.config.log.logging_enabled",
+ &Log::handle_logging_mode_change, NULL);
+
+ REC_RegisterConfigUpdateFunc("proxy.local.log.collation_mode",
+ &Log::handle_logging_mode_change, NULL);
// we must create the flush thread since it takes care of the
// periodic events (should this behavior be reversed ?)
@@ -997,7 +1001,8 @@ Log::init(int flags)
// Clear any stat values that need to be reset on startup
//
- LOG_CLEAR_DYN_STAT( log_stat_log_files_open_stat);
+ RecSetRawStatSum(log_rsb, log_stat_log_files_open_stat, 0);
+ RecSetRawStatCount(log_rsb, log_stat_log_files_open_stat, 0);
}
if (config_flags & LOGCAT) {
@@ -1108,7 +1113,8 @@ Log::create_threads()
// condition variable.
//
Continuation *collate_continuation = NEW(new LoggingCollateContinuation);
- Event *collate_event = eventProcessor.spawn_thread(collate_continuation);
+ sprintf(desc, "[LOG_COLLATION]");
+ Event *collate_event = eventProcessor.spawn_thread(collate_continuation, desc);
collate_thread = collate_event->ethread->tid;
#endif
init_status |= THREADS_CREATED;
@@ -1137,6 +1143,7 @@ Log::access(LogAccess * lad)
int ret;
static long sample = 1;
long this_sample;
+ ProxyMutex *mutex = this_ethread()->mutex;
// See if we're sampling and it is not time for another sample
//
@@ -1144,6 +1151,7 @@ Log::access(LogAccess * lad)
this_sample = sample++;
if (this_sample && this_sample % Log::config->sampling_frequency) {
Debug("log", "sampling, skipping this entry ...");
+ RecIncrRawStat(log_rsb, mutex->thread_holding, log_stat_event_log_access_skip_stat, 1);
ret = Log::SKIP;
goto done;
} else {
@@ -1154,6 +1162,7 @@ Log::access(LogAccess * lad)
if (Log::config->log_object_manager.get_num_objects() == 0) {
Debug("log", "no log objects, skipping this entry ...");
+ RecIncrRawStat(log_rsb, mutex->thread_holding, log_stat_event_log_access_skip_stat, 1);
ret = Log::SKIP;
goto done;
}
@@ -1183,6 +1192,7 @@ int
Log::error(const char *format, ...)
{
int ret_val = Log::SKIP;
+ ProxyMutex *mutex = this_ethread()->mutex;
if (error_log) {
ink_assert(format != NULL);
@@ -1191,11 +1201,36 @@ Log::error(const char *format, ...)
ret_val = error_log->va_write(format, ap);
va_end(ap);
- if (ret_val == Log::LOG_OK) {
- ProxyMutex *mutex = this_ethread()->mutex;
- LOG_INCREMENT_DYN_STAT(log_stat_event_log_error_stat);
+ switch (ret_val) {
+ case Log::LOG_OK:
+ RecIncrRawStat(log_rsb, mutex->thread_holding,
+ log_stat_event_log_error_ok_stat, 1);
+ break;
+ case Log::SKIP:
+ RecIncrRawStat(log_rsb, mutex->thread_holding,
+ log_stat_event_log_error_skip_stat, 1);
+ break;
+ case Log::AGGR:
+ RecIncrRawStat(log_rsb, mutex->thread_holding,
+ log_stat_event_log_error_aggr_stat, 1);
+ break;
+ case Log::FULL:
+ RecIncrRawStat(log_rsb, mutex->thread_holding,
+ log_stat_event_log_error_full_stat, 1);
+ break;
+ case Log::FAIL:
+ RecIncrRawStat(log_rsb, mutex->thread_holding,
+ log_stat_event_log_error_fail_stat, 1);
+ break;
+ default:
+ ink_release_assert(!"Unexpected result");
}
+
+ return ret_val;
}
+
+ RecIncrRawStat(log_rsb, mutex->thread_holding,
+ log_stat_event_log_error_skip_stat, 1);
return ret_val;
}
@@ -1206,13 +1241,35 @@ Log::va_error(char *format, va_list ap)
if (error_log) {
ink_assert(format != NULL);
+ ProxyMutex *mutex = this_ethread()->mutex;
ret_val = error_log->va_write(format, ap);
- if (ret_val == Log::LOG_OK) {
- ProxyMutex *mutex = this_ethread()->mutex;
- LOG_INCREMENT_DYN_STAT(log_stat_event_log_error_stat);
+ switch (ret_val) {
+ case Log::LOG_OK:
+ RecIncrRawStat(log_rsb, mutex->thread_holding,
+ log_stat_event_log_error_ok_stat, 1);
+ break;
+ case Log::SKIP:
+ RecIncrRawStat(log_rsb, mutex->thread_holding,
+ log_stat_event_log_error_skip_stat, 1);
+ break;
+ case Log::AGGR:
+ RecIncrRawStat(log_rsb, mutex->thread_holding,
+ log_stat_event_log_error_aggr_stat, 1);
+ break;
+ case Log::FULL:
+ RecIncrRawStat(log_rsb, mutex->thread_holding,
+ log_stat_event_log_error_full_stat, 1);
+ break;
+ case Log::FAIL:
+ RecIncrRawStat(log_rsb, mutex->thread_holding,
+ log_stat_event_log_error_fail_stat, 1);
+ break;
+ default:
+ ink_release_assert(!"Unexpected result");
}
}
+
return ret_val;
}
@@ -1269,6 +1326,7 @@ Log::flush_thread_main(void * /* args ATS_UNUSED */)
ink_hrtime now, last_time = 0;
int len, bytes_written, total_bytes;
SLL<LogFlushData, LogFlushData::Link_link> link, invert_link;
+ ProxyMutex *mutex = this_thread()->mutex;
Log::flush_notify->lock();
@@ -1336,6 +1394,9 @@ Log::flush_thread_main(void * /* args ATS_UNUSED */)
bytes_written += len;
}
+ RecIncrRawStat(log_rsb, mutex->thread_holding,
+ log_stat_bytes_written_to_disk_stat, bytes_written);
+
ink_atomic_increment(&logfile->m_bytes_written, bytes_written);
delete fdata;
@@ -1457,7 +1518,6 @@ Log::collate_thread_main(void * /* args ATS_UNUSED */)
}
Debug("log-sock", "message accepted, size = %d", bytes_read);
- LOG_SUM_GLOBAL_DYN_STAT(log_stat_bytes_received_from_network_stat, bytes_read);
obj = match_logobject(header);
if (!obj) {
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9d2acd0a/proxy/logging/Log.h
----------------------------------------------------------------------
diff --git a/proxy/logging/Log.h b/proxy/logging/Log.h
index 2233220..6bfc689 100644
--- a/proxy/logging/Log.h
+++ b/proxy/logging/Log.h
@@ -356,10 +356,11 @@ public:
enum ReturnCodeFlags
{
- LOG_OK = 0,
- SKIP = 1,
- FAIL = 2,
- FULL = 4
+ LOG_OK = 1,
+ SKIP = 2,
+ AGGR = 4,
+ FAIL = 8,
+ FULL = 16
};
enum LoggingMode
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9d2acd0a/proxy/logging/LogAccess.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogAccess.cc b/proxy/logging/LogAccess.cc
index ea38b5a..7cecced 100644
--- a/proxy/logging/LogAccess.cc
+++ b/proxy/logging/LogAccess.cc
@@ -600,7 +600,7 @@ int
LogAccess::marshal_config_int_var(char *config_var, char *buf)
{
if (buf) {
- int64_t val = (int64_t) LOG_ConfigReadInteger(config_var);
+ int64_t val = (int64_t) REC_ConfigReadInteger(config_var);
marshal_int(buf, val);
}
return INK_MIN_ALIGN;
@@ -613,7 +613,7 @@ int
LogAccess::marshal_config_str_var(char *config_var, char *buf)
{
char *str = NULL;
- str = LOG_ConfigReadString(config_var);
+ str = REC_ConfigReadString(config_var);
int len = LogAccess::strlen(str);
if (buf) {
marshal_str(buf, str, len);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9d2acd0a/proxy/logging/LogCollationClientSM.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogCollationClientSM.cc b/proxy/logging/LogCollationClientSM.cc
index f917742..e4d2a65 100644
--- a/proxy/logging/LogCollationClientSM.cc
+++ b/proxy/logging/LogCollationClientSM.cc
@@ -635,6 +635,12 @@ LogCollationClientSM::client_send(int event, VIO * /* vio ATS_UNUSED */)
// TODO: We currently don't try to make the log buffers handle little vs big endian. TS-1156.
//m_buffer_in_iocore->convert_to_network_order();
+ RecIncrRawStat(log_rsb, mutex->thread_holding, log_stat_num_sent_to_network_stat,
+ log_buffer_header->entry_count);
+
+ RecIncrRawStat(log_rsb, mutex->thread_holding, log_stat_bytes_sent_to_network_stat,
+ log_buffer_header->byte_count);
+
// copy into m_send_buffer
ink_assert(m_send_buffer != NULL);
m_send_buffer->write((char *) &nmh, sizeof(NetMsgHeader));
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9d2acd0a/proxy/logging/LogCollationHostSM.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogCollationHostSM.cc b/proxy/logging/LogCollationHostSM.cc
index 36452f2..f9af15f 100644
--- a/proxy/logging/LogCollationHostSM.cc
+++ b/proxy/logging/LogCollationHostSM.cc
@@ -320,6 +320,13 @@ LogCollationHostSM::host_recv(int event, void * /* data ATS_UNUSED */)
// object's flush queue
//
log_buffer = NEW(new LogBuffer(log_object, log_buffer_header));
+
+ RecIncrRawStat(log_rsb, mutex->thread_holding, log_stat_num_received_from_network_stat,
+ log_buffer_header->entry_count);
+
+ RecIncrRawStat(log_rsb, mutex->thread_holding, log_stat_bytes_received_from_network_stat,
+ log_buffer_header->byte_count);
+
int idx = log_object->add_to_flush_queue(log_buffer);
Log::preproc_notify[idx].signal();
}
@@ -517,8 +524,4 @@ LogCollationHostSM::read_partial(VIO * vio)
int64_t bytes_received_now = m_client_reader->read(p, bytes_wanted_now);
m_read_bytes_received += bytes_received_now;
-
- // stats
- LOG_SUM_DYN_STAT(log_stat_bytes_received_from_network_stat, bytes_received_now);
-
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9d2acd0a/proxy/logging/LogConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogConfig.cc b/proxy/logging/LogConfig.cc
index 8e3b585..7dbabed 100644
--- a/proxy/logging/LogConfig.cc
+++ b/proxy/logging/LogConfig.cc
@@ -201,33 +201,33 @@ LogConfig::read_configuration_variables()
int val;
char *ptr;
- val = (int) LOG_ConfigReadInteger("proxy.config.log.log_buffer_size");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.log_buffer_size");
if (val > 0) {
log_buffer_size = val;
}
- val = (int) LOG_ConfigReadInteger("proxy.config.log.max_secs_per_buffer");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.max_secs_per_buffer");
if (val > 0) {
max_secs_per_buffer = val;
}
- val = (int) LOG_ConfigReadInteger("proxy.config.log.max_space_mb_for_logs");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.max_space_mb_for_logs");
if (val > 0) {
max_space_mb_for_logs = val;
}
- val = (int) LOG_ConfigReadInteger("proxy.config.log.max_space_mb_for_" "orphan_logs");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.max_space_mb_for_" "orphan_logs");
if (val > 0) {
max_space_mb_for_orphan_logs = val;
}
- val = (int) LOG_ConfigReadInteger("proxy.config.log.max_space_mb_headroom");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.max_space_mb_headroom");
if (val > 0) {
max_space_mb_headroom = val;
}
// TODO: We should mover this "parser" to lib/ts
- ptr = LOG_ConfigReadString("proxy.config.log.logfile_perm");
+ ptr = REC_ConfigReadString("proxy.config.log.logfile_perm");
if (ptr && strlen(ptr) == 9) {
logfile_perm = 0;
char *c = ptr;
@@ -260,13 +260,13 @@ LogConfig::read_configuration_variables()
ats_free(ptr);
}
- ptr = LOG_ConfigReadString("proxy.config.log.hostname");
+ ptr = REC_ConfigReadString("proxy.config.log.hostname");
if (ptr != NULL) {
ats_free(hostname);
hostname = ptr;
}
- ptr = LOG_ConfigReadString("proxy.config.log.logfile_dir");
+ ptr = REC_ConfigReadString("proxy.config.log.logfile_dir");
if (ptr != NULL) {
ats_free(logfile_dir);
// Make it relative from Layout
@@ -303,80 +303,80 @@ LogConfig::read_configuration_variables()
// SQUID
- val = (int) LOG_ConfigReadInteger("proxy.config.log.squid_log_enabled");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.squid_log_enabled");
squid_log_enabled = (val > 0);
// X-UID logging enabled.
- val = (int) LOG_ConfigReadInteger("proxy.config.log.xuid_logging_enabled");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.xuid_logging_enabled");
xuid_logging_enabled = (val > 0);
- val = (int) LOG_ConfigReadInteger("proxy.config.log.squid_log_is_ascii");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.squid_log_is_ascii");
squid_log_is_ascii = (val > 0);
- ptr = LOG_ConfigReadString("proxy.config.log.squid_log_name");
+ ptr = REC_ConfigReadString("proxy.config.log.squid_log_name");
if (ptr != NULL) {
ats_free(squid_log_name);
squid_log_name = ptr;
}
- ptr = LOG_ConfigReadString("proxy.config.log.squid_log_header");
+ ptr = REC_ConfigReadString("proxy.config.log.squid_log_header");
if (ptr != NULL) {
ats_free(squid_log_header);
squid_log_header = ptr;
}
// COMMON
- val = (int) LOG_ConfigReadInteger("proxy.config.log.common_log_enabled");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.common_log_enabled");
common_log_enabled = (val > 0);
- val = (int) LOG_ConfigReadInteger("proxy.config.log.common_log_is_ascii");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.common_log_is_ascii");
common_log_is_ascii = (val > 0);
- ptr = LOG_ConfigReadString("proxy.config.log.common_log_name");
+ ptr = REC_ConfigReadString("proxy.config.log.common_log_name");
if (ptr != NULL) {
ats_free(common_log_name);
common_log_name = ptr;
}
- ptr = LOG_ConfigReadString("proxy.config.log.common_log_header");
+ ptr = REC_ConfigReadString("proxy.config.log.common_log_header");
if (ptr != NULL) {
ats_free(common_log_header);
common_log_header = ptr;
}
// EXTENDED
- val = (int) LOG_ConfigReadInteger("proxy.config.log.extended_log_enabled");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.extended_log_enabled");
extended_log_enabled = (val > 0);
- val = (int) LOG_ConfigReadInteger("proxy.config.log.extended_log_is_ascii");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.extended_log_is_ascii");
extended_log_is_ascii = (val > 0);
- ptr = LOG_ConfigReadString("proxy.config.log.extended_log_name");
+ ptr = REC_ConfigReadString("proxy.config.log.extended_log_name");
if (ptr != NULL) {
ats_free(extended_log_name);
extended_log_name = ptr;
}
- ptr = LOG_ConfigReadString("proxy.config.log.extended_log_header");
+ ptr = REC_ConfigReadString("proxy.config.log.extended_log_header");
if (ptr != NULL) {
ats_free(extended_log_header);
extended_log_header = ptr;
}
// EXTENDED2
- val = (int) LOG_ConfigReadInteger("proxy.config.log.extended2_log_enabled");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.extended2_log_enabled");
extended2_log_enabled = (val > 0);
- val = (int) LOG_ConfigReadInteger("proxy.config.log.extended2_log_is_ascii");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.extended2_log_is_ascii");
extended2_log_is_ascii = (val > 0);
- ptr = LOG_ConfigReadString("proxy.config.log.extended2_log_name");
+ ptr = REC_ConfigReadString("proxy.config.log.extended2_log_name");
if (ptr != NULL) {
ats_free(extended2_log_name);
extended2_log_name = ptr;
}
- ptr = LOG_ConfigReadString("proxy.config.log.extended2_log_header");
+ ptr = REC_ConfigReadString("proxy.config.log.extended2_log_header");
if (ptr != NULL) {
ats_free(extended2_log_header);
extended2_log_header = ptr;
@@ -388,50 +388,50 @@ LogConfig::read_configuration_variables()
// 1 means splitting
// for icp
// -1 means filter out (do not log and do not create split file)
- val = (int) LOG_ConfigReadInteger("proxy.config.log.separate_icp_logs");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.separate_icp_logs");
separate_icp_logs = (val > 0);
- val = (int) LOG_ConfigReadInteger("proxy.config.log.separate_host_logs");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.separate_host_logs");
separate_host_logs = (val > 0);
// COLLATION
- val = (int) LOG_LocalReadInteger("proxy.local.log.collation_mode");
+ val = (int) REC_ConfigReadInteger("proxy.local.log.collation_mode");
// do not restrict value so that error message is logged if
// collation_mode is out of range
collation_mode = val;
- ptr = LOG_ConfigReadString("proxy.config.log.collation_host");
+ ptr = REC_ConfigReadString("proxy.config.log.collation_host");
if (ptr != NULL) {
ats_free(collation_host);
collation_host = ptr;
}
- val = (int) LOG_ConfigReadInteger("proxy.config.log.collation_port");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.collation_port");
if (val >= 0) {
collation_port = val;
}
- val = (int) LOG_ConfigReadInteger("proxy.config.log.collation_host_tagged");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.collation_host_tagged");
collation_host_tagged = (val > 0);
- val = (int) LOG_ConfigReadInteger("proxy.config.log.collation_preproc_threads");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.collation_preproc_threads");
if (val > 0 && val <= 128) {
collation_preproc_threads = val;
}
- ptr = LOG_ConfigReadString("proxy.config.log.collation_secret");
+ ptr = REC_ConfigReadString("proxy.config.log.collation_secret");
if (ptr != NULL) {
ats_free(collation_secret);
collation_secret = ptr;
}
- val = (int) LOG_ConfigReadInteger("proxy.config.log.collation_retry_sec");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.collation_retry_sec");
if (val >= 0) {
collation_retry_sec = val;
}
- val = (int) LOG_ConfigReadInteger("proxy.config.log.collation_max_send_buffers");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.collation_max_send_buffers");
if (val >= 0) {
collation_max_send_buffers = val;
}
@@ -442,53 +442,53 @@ LogConfig::read_configuration_variables()
// we don't check for valid values of rolling_enabled, rolling_interval_sec,
// rolling_offset_hr, or rolling_size_mb because the LogObject takes care of this
//
- rolling_enabled = (int) LOG_ConfigReadInteger("proxy.config.log.rolling_enabled");
- rolling_interval_sec = (int) LOG_ConfigReadInteger("proxy.config.log.rolling_interval_sec");
- rolling_offset_hr = (int) LOG_ConfigReadInteger("proxy.config.log.rolling_offset_hr");
- rolling_size_mb = (int) LOG_ConfigReadInteger("proxy.config.log.rolling_size_mb");
+ rolling_enabled = (int) REC_ConfigReadInteger("proxy.config.log.rolling_enabled");
+ rolling_interval_sec = (int) REC_ConfigReadInteger("proxy.config.log.rolling_interval_sec");
+ rolling_offset_hr = (int) REC_ConfigReadInteger("proxy.config.log.rolling_offset_hr");
+ rolling_size_mb = (int) REC_ConfigReadInteger("proxy.config.log.rolling_size_mb");
- val = (int) LOG_ConfigReadInteger("proxy.config.log." "auto_delete_rolled_files");
+ val = (int) REC_ConfigReadInteger("proxy.config.log." "auto_delete_rolled_files");
auto_delete_rolled_files = (val > 0);
// CUSTOM LOGGING
- val = (int) LOG_ConfigReadInteger("proxy.config.log.custom_logs_enabled");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.custom_logs_enabled");
custom_logs_enabled = (val > 0);
- ptr = LOG_ConfigReadString("proxy.config.log.xml_config_file");
+ ptr = REC_ConfigReadString("proxy.config.log.xml_config_file");
if (ptr != NULL) {
ats_free(xml_config_file);
xml_config_file = ptr;
}
- ptr = LOG_ConfigReadString("proxy.config.log.hosts_config_file");
+ ptr = REC_ConfigReadString("proxy.config.log.hosts_config_file");
if (ptr != NULL) {
ats_free(hosts_config_file);
hosts_config_file = ptr;
}
// PERFORMANCE
- val = (int) LOG_ConfigReadInteger("proxy.config.log.sampling_frequency");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.sampling_frequency");
if (val > 0) {
sampling_frequency = val;
}
- val = (int) LOG_ConfigReadInteger("proxy.config.log.file_stat_frequency");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.file_stat_frequency");
if (val > 0) {
file_stat_frequency = val;
}
- val = (int) LOG_ConfigReadInteger("proxy.config.log.space_used_frequency");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.space_used_frequency");
if (val > 0) {
space_used_frequency = val;
}
// ASCII BUFFER
- val = (int) LOG_ConfigReadInteger("proxy.config.log.ascii_buffer_size");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.ascii_buffer_size");
if (val > 0) {
ascii_buffer_size = val;
}
- val = (int) LOG_ConfigReadInteger("proxy.config.log.max_line_size");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.max_line_size");
if (val > 0) {
max_line_size = val;
}
@@ -496,7 +496,7 @@ LogConfig::read_configuration_variables()
/* The following variables are initialized after reading the */
/* variable values from records.config */
- val = (int) LOG_ConfigReadInteger("proxy.config.log.search_log_enabled");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.search_log_enabled");
if (Log::logging_mode == Log::FULL_LOGGING)
search_log_enabled = (val > 0);
@@ -505,7 +505,7 @@ LogConfig::read_configuration_variables()
/* log object. User can define the filter to exclude URLs with */
/* certain file extensions from being logged. */
/* */
- ptr = LOG_ConfigReadString("proxy.config.log.search_log_filters");
+ ptr = REC_ConfigReadString("proxy.config.log.search_log_filters");
if (ptr != NULL) {
search_log_filters = ptr;
}
@@ -517,17 +517,17 @@ LogConfig::read_configuration_variables()
/* sites. This file is sent to search server mentioned by the */
/* pair ip-address & port. */
/* */
- ptr = LOG_ConfigReadString("proxy.config.log.search_url_filter");
+ ptr = REC_ConfigReadString("proxy.config.log.search_url_filter");
if (ptr != NULL) {
search_url_filter = ptr;
}
- val = (int) LOG_ConfigReadInteger("proxy.config.log.search_top_sites");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.search_top_sites");
if (val > 0) {
search_top_sites = val;
}
- ptr = LOG_ConfigReadString("proxy.config.log.search_server_ip_addr");
+ ptr = REC_ConfigReadString("proxy.config.log.search_server_ip_addr");
if (ptr != NULL) {
unsigned int ipaddr;
ipaddr = inet_addr(ptr);
@@ -537,13 +537,13 @@ LogConfig::read_configuration_variables()
search_server_ip_addr = 0;
}
- val = (int) LOG_ConfigReadInteger("proxy.config.log.search_server_port");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.search_server_port");
if (val > 0) {
search_server_port = val;
}
/* Rolling interval is taken care in LogObject. */
- val = (int) LOG_ConfigReadInteger("proxy.config.log.search_rolling_interval_sec");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.search_rolling_interval_sec");
if (val > 0) {
search_rolling_interval_sec = val;
}
@@ -1219,85 +1219,85 @@ LogConfig::register_config_callbacks()
{
// Note: variables that are not exposed in the UI are commented out
//
- LOG_RegisterConfigUpdateFunc("proxy.config.log.log_buffer_size", &LogConfig::reconfigure, NULL);
-// LOG_RegisterConfigUpdateFunc ("proxy.config.log.max_secs_per_buffer",
+ REC_RegisterConfigUpdateFunc("proxy.config.log.log_buffer_size", &LogConfig::reconfigure, NULL);
+// REC_RegisterConfigUpdateFunc ("proxy.config.log.max_secs_per_buffer",
// &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.max_space_mb_for_logs", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.max_space_mb_for_orphan_logs", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.max_space_mb_headroom", &LogConfig::reconfigure, NULL);
-// LOG_RegisterConfigUpdateFunc ("proxy.config.log.logfile_perm",
+ REC_RegisterConfigUpdateFunc("proxy.config.log.max_space_mb_for_logs", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.max_space_mb_for_orphan_logs", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.max_space_mb_headroom", &LogConfig::reconfigure, NULL);
+// REC_RegisterConfigUpdateFunc ("proxy.config.log.logfile_perm",
// &LogConfig::reconfigure, NULL);
-// LOG_RegisterConfigUpdateFunc ("proxy.config.log.hostname",
+// REC_RegisterConfigUpdateFunc ("proxy.config.log.hostname",
// &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.logfile_dir", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.logfile_dir", &LogConfig::reconfigure, NULL);
// SQUID
- LOG_RegisterConfigUpdateFunc("proxy.config.log.squid_log_enabled", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.xuid_logging_enabled", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.squid_log_is_ascii", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.squid_log_name", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.squid_log_header", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.squid_log_enabled", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.xuid_logging_enabled", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.squid_log_is_ascii", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.squid_log_name", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.squid_log_header", &LogConfig::reconfigure, NULL);
// COMMON
- LOG_RegisterConfigUpdateFunc("proxy.config.log.common_log_enabled", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.common_log_is_ascii", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.common_log_name", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.common_log_header", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.common_log_enabled", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.common_log_is_ascii", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.common_log_name", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.common_log_header", &LogConfig::reconfigure, NULL);
// EXTENDED
- LOG_RegisterConfigUpdateFunc("proxy.config.log.extended_log_enabled", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.extended_log_is_ascii", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.extended_log_name", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.extended_log_header", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.extended_log_enabled", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.extended_log_is_ascii", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.extended_log_name", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.extended_log_header", &LogConfig::reconfigure, NULL);
// EXTENDED2
- LOG_RegisterConfigUpdateFunc("proxy.config.log.extended2_log_enabled", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.extended2_log_is_ascii", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.extended2_log_name", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.extended2_log_header", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.extended2_log_enabled", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.extended2_log_is_ascii", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.extended2_log_name", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.extended2_log_header", &LogConfig::reconfigure, NULL);
// SPLITTING
- LOG_RegisterConfigUpdateFunc("proxy.config.log.separate_icp_logs", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.separate_host_logs", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.separate_icp_logs", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.separate_host_logs", &LogConfig::reconfigure, NULL);
// COLLATION
- LOG_RegisterLocalUpdateFunc("proxy.local.log.collation_mode", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.collation_host", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.collation_port", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.collation_host_tagged", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.collation_secret", &LogConfig::reconfigure, NULL);
-// LOG_RegisterConfigUpdateFunc ("proxy.config.log.collation_retry_sec",
+ REC_RegisterConfigUpdateFunc("proxy.local.log.collation_mode", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.collation_host", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.collation_port", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.collation_host_tagged", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.collation_secret", &LogConfig::reconfigure, NULL);
+// REC_RegisterConfigUpdateFunc ("proxy.config.log.collation_retry_sec",
// &LogConfig::reconfigure, NULL);
-// LOG_RegisterConfigUpdateFunc ("proxy.config.log.collation_max_send_buffers",
+// REC_RegisterConfigUpdateFunc ("proxy.config.log.collation_max_send_buffers",
// &LogConfig::reconfigure, NULL);
// ROLLING
- LOG_RegisterConfigUpdateFunc("proxy.config.log.rolling_enabled", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.rolling_interval_sec", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.rolling_offset_hr", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.rolling_size_mb", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.auto_delete_rolled_files", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.rolling_enabled", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.rolling_interval_sec", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.rolling_offset_hr", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.rolling_size_mb", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.auto_delete_rolled_files", &LogConfig::reconfigure, NULL);
// CUSTOM LOGGING
- LOG_RegisterConfigUpdateFunc("proxy.config.log.custom_logs_enabled", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.xml_config_file", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.hosts_config_file", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.custom_logs_enabled", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.xml_config_file", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.hosts_config_file", &LogConfig::reconfigure, NULL);
// PERFORMANCE
-// LOG_RegisterConfigUpdateFunc ("proxy.config.log.sampling_frequency",
+// REC_RegisterConfigUpdateFunc ("proxy.config.log.sampling_frequency",
// &LogConfig::reconfigure, NULL);
-// LOG_RegisterConfigUpdateFunc ("proxy.config.log.file_stat_frequency",
+// REC_RegisterConfigUpdateFunc ("proxy.config.log.file_stat_frequency",
// &LogConfig::reconfigure, NULL);
-// LOG_RegisterConfigUpdateFunc ("proxy.config.log.space_used_frequency",
+// REC_RegisterConfigUpdateFunc ("proxy.config.log.space_used_frequency",
// &LogConfig::reconfigure, NULL);
/* These are the call back function connectivities */
- LOG_RegisterConfigUpdateFunc("proxy.config.log.search_rolling_interval_sec", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.search_log_enabled", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.search_top_sites", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.search_server_ip_addr", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.search_server_port", &LogConfig::reconfigure, NULL);
- LOG_RegisterConfigUpdateFunc("proxy.config.log.search_url_filter", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.search_rolling_interval_sec", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.search_log_enabled", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.search_top_sites", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.search_server_ip_addr", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.search_server_port", &LogConfig::reconfigure, NULL);
+ REC_RegisterConfigUpdateFunc("proxy.config.log.search_url_filter", &LogConfig::reconfigure, NULL);
}
@@ -1311,60 +1311,72 @@ LogConfig::register_config_callbacks()
void
LogConfig::register_stat_callbacks()
{
-#define LOG_CLEAR_DYN_STAT(x) \
-do { \
- RecSetRawStatSum(log_rsb, x, 0); \
- RecSetRawStatCount(log_rsb, x, 0); \
-} while (0);
//
- // bytes moved
+ // events
//
RecRegisterRawStat(log_rsb, RECT_PROCESS,
- "proxy.process.log.bytes_buffered",
- RECD_INT, RECP_PERSISTENT, (int) log_stat_bytes_buffered_stat, RecRawStatSyncSum);
-
+ "proxy.process.log.event_log_error_ok",
+ RECD_COUNTER, RECP_PERSISTENT, (int) log_stat_event_log_error_ok_stat, RecRawStatSyncCount);
RecRegisterRawStat(log_rsb, RECT_PROCESS,
- "proxy.process.log.bytes_written_to_disk",
- RECD_INT, RECP_PERSISTENT, (int) log_stat_bytes_written_to_disk_stat, RecRawStatSyncSum);
-
+ "proxy.process.log.event_log_error_skip",
+ RECD_COUNTER, RECP_PERSISTENT, (int) log_stat_event_log_error_skip_stat, RecRawStatSyncCount);
+ RecRegisterRawStat(log_rsb, RECT_PROCESS,
+ "proxy.process.log.event_log_error_aggr",
+ RECD_COUNTER, RECP_PERSISTENT, (int) log_stat_event_log_error_aggr_stat, RecRawStatSyncCount);
+ RecRegisterRawStat(log_rsb, RECT_PROCESS,
+ "proxy.process.log.event_log_error_full",
+ RECD_COUNTER, RECP_PERSISTENT, (int) log_stat_event_log_error_full_stat, RecRawStatSyncCount);
+ RecRegisterRawStat(log_rsb, RECT_PROCESS,
+ "proxy.process.log.event_log_error_fail",
+ RECD_COUNTER, RECP_PERSISTENT, (int) log_stat_event_log_error_fail_stat, RecRawStatSyncCount);
+ RecRegisterRawStat(log_rsb, RECT_PROCESS,
+ "proxy.process.log.event_log_access_ok",
+ RECD_COUNTER, RECP_PERSISTENT, (int) log_stat_event_log_access_ok_stat, RecRawStatSyncCount);
+ RecRegisterRawStat(log_rsb, RECT_PROCESS,
+ "proxy.process.log.event_log_access_skip",
+ RECD_COUNTER, RECP_PERSISTENT, (int) log_stat_event_log_access_skip_stat, RecRawStatSyncCount);
+ RecRegisterRawStat(log_rsb, RECT_PROCESS,
+ "proxy.process.log.event_log_access_aggr",
+ RECD_COUNTER, RECP_PERSISTENT, (int) log_stat_event_log_access_aggr_stat, RecRawStatSyncCount);
+ RecRegisterRawStat(log_rsb, RECT_PROCESS,
+ "proxy.process.log.event_log_access_full",
+ RECD_COUNTER, RECP_PERSISTENT, (int) log_stat_event_log_access_full_stat, RecRawStatSyncCount);
+ RecRegisterRawStat(log_rsb, RECT_PROCESS,
+ "proxy.process.log.event_log_access_fail",
+ RECD_COUNTER, RECP_PERSISTENT, (int) log_stat_event_log_access_fail_stat, RecRawStatSyncCount);
+ //
+ // number vs bytes of logs
+ //
+ RecRegisterRawStat(log_rsb, RECT_PROCESS,
+ "proxy.process.log.num_sent_to_network",
+ RECD_INT, RECP_PERSISTENT, (int) log_stat_num_sent_to_network_stat, RecRawStatSyncSum);
+ RecRegisterRawStat(log_rsb, RECT_PROCESS,
+ "proxy.process.log.num_received_from_network",
+ RECD_INT, RECP_PERSISTENT, (int) log_stat_num_received_from_network_stat, RecRawStatSyncSum);
+ RecRegisterRawStat(log_rsb, RECT_PROCESS,
+ "proxy.process.log.num_flush_to_disk",
+ RECD_INT, RECP_PERSISTENT, (int) log_stat_num_flush_to_disk_stat, RecRawStatSyncSum);
RecRegisterRawStat(log_rsb, RECT_PROCESS,
"proxy.process.log.bytes_sent_to_network",
RECD_INT, RECP_PERSISTENT, (int) log_stat_bytes_sent_to_network_stat, RecRawStatSyncSum);
-
RecRegisterRawStat(log_rsb, RECT_PROCESS,
"proxy.process.log.bytes_received_from_network",
RECD_INT, RECP_PERSISTENT, (int) log_stat_bytes_received_from_network_stat, RecRawStatSyncSum);
-
+ RecRegisterRawStat(log_rsb, RECT_PROCESS,
+ "proxy.process.log.bytes_flush_to_disk",
+ RECD_INT, RECP_PERSISTENT, (int) log_stat_bytes_flush_to_disk_stat, RecRawStatSyncSum);
+ RecRegisterRawStat(log_rsb, RECT_PROCESS,
+ "proxy.process.log.bytes_written_to_disk",
+ RECD_INT, RECP_PERSISTENT, (int) log_stat_bytes_written_to_disk_stat, RecRawStatSyncSum);
//
// I/O
//
RecRegisterRawStat(log_rsb, RECT_PROCESS,
"proxy.process.log.log_files_open",
RECD_COUNTER, RECP_NON_PERSISTENT, (int) log_stat_log_files_open_stat, RecRawStatSyncSum);
- LOG_CLEAR_DYN_STAT(log_stat_log_files_open_stat);
-
RecRegisterRawStat(log_rsb, RECT_PROCESS,
"proxy.process.log.log_files_space_used",
RECD_INT, RECP_NON_PERSISTENT, (int) log_stat_log_files_space_used_stat, RecRawStatSyncSum);
-
- //
- // events
- //
- RecRegisterRawStat(log_rsb, RECT_PROCESS,
- "proxy.process.log.event_log_error",
- RECD_COUNTER, RECP_PERSISTENT, (int) log_stat_event_log_error_stat, RecRawStatSyncCount);
-
- RecRegisterRawStat(log_rsb, RECT_PROCESS,
- "proxy.process.log.event_log_access",
- RECD_COUNTER, RECP_PERSISTENT, (int) log_stat_event_log_access_stat, RecRawStatSyncCount);
-
- RecRegisterRawStat(log_rsb, RECT_PROCESS,
- "proxy.process.log.event_log_access_fail",
- RECD_COUNTER, RECP_PERSISTENT, (int) log_stat_event_log_access_fail_stat, RecRawStatSyncCount);
-
- RecRegisterRawStat(log_rsb, RECT_PROCESS,
- "proxy.process.log.event_log_access_skip",
- RECD_COUNTER, RECP_PERSISTENT, (int) log_stat_event_log_access_skip_stat, RecRawStatSyncCount);
}
/*-------------------------------------------------------------------------
@@ -1377,7 +1389,7 @@ do { \
void
LogConfig::register_mgmt_callbacks()
{
- LOG_RegisterMgmtCallback(REC_EVENT_ROLL_LOG_FILES, &LogConfig::reconfigure_mgmt_variables, NULL);
+ RecRegisterManagerCb(REC_EVENT_ROLL_LOG_FILES, &LogConfig::reconfigure_mgmt_variables, NULL);
}
@@ -1538,7 +1550,8 @@ LogConfig::update_space_used()
//
m_space_used = total_space_used;
m_partition_space_left = partition_space_left;
- LOG_SET_DYN_STAT(log_stat_log_files_space_used_stat, 1, m_space_used);
+ RecSetRawStatSum(log_rsb, log_stat_log_files_space_used_stat, m_space_used);
+ RecSetRawStatCount(log_rsb, log_stat_log_files_space_used_stat, 1);
Debug("logspace", "%" PRId64 " bytes being used for logs", m_space_used);
Debug("logspace", "%" PRId64 " bytes left on parition", m_partition_space_left);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9d2acd0a/proxy/logging/LogConfig.h
----------------------------------------------------------------------
diff --git a/proxy/logging/LogConfig.h b/proxy/logging/LogConfig.h
index 927e2bb..d9e46c4 100644
--- a/proxy/logging/LogConfig.h
+++ b/proxy/logging/LogConfig.h
@@ -35,52 +35,39 @@
*/
enum
{
- log_stat_bytes_buffered_stat,
- log_stat_bytes_written_to_disk_stat,
+ // Logging Events
+ log_stat_event_log_error_ok_stat,
+ log_stat_event_log_error_skip_stat,
+ log_stat_event_log_error_aggr_stat,
+ log_stat_event_log_error_full_stat,
+ log_stat_event_log_error_fail_stat,
+
+ log_stat_event_log_access_ok_stat,
+ log_stat_event_log_access_skip_stat,
+ log_stat_event_log_access_aggr_stat,
+ log_stat_event_log_access_full_stat,
+ log_stat_event_log_access_fail_stat,
+
+ // Logging Data
+ log_stat_num_sent_to_network_stat,
+ log_stat_num_received_from_network_stat,
+ log_stat_num_flush_to_disk_stat,
+
log_stat_bytes_sent_to_network_stat,
log_stat_bytes_received_from_network_stat,
+
+ log_stat_bytes_flush_to_disk_stat,
+ log_stat_bytes_written_to_disk_stat,
+
// Logging I/O
log_stat_log_files_open_stat,
log_stat_log_files_space_used_stat,
- // Logging Events
- log_stat_event_log_error_stat,
- log_stat_event_log_access_stat,
- log_stat_event_log_access_fail_stat,
- log_stat_event_log_access_skip_stat,
+
log_stat_count
};
extern RecRawStatBlock *log_rsb;
-/* Stats should only be accessed using these macros */
-
-#define LOG_SET_DYN_STAT(x,C, S) \
-do { \
- RecSetRawStatSum(log_rsb, x, S); \
- RecSetRawStatCount(log_rsb, x, C); \
-} while (0);
-#define LOG_INCREMENT_DYN_STAT(x) \
- RecIncrRawStat(log_rsb, mutex->thread_holding, (int) x, 1);
-#define LOG_DECREMENT_DYN_STAT(x) \
- RecIncrRawStat(log_rsb, mutex->thread_holding, (int) x, -1);
-#define LOG_SUM_DYN_STAT(x, y) \
- RecIncrRawStat(log_rsb, mutex->thread_holding, (int) x, y);
-#define LOG_SUM_GLOBAL_DYN_STAT(x, y) \
- RecIncrGlobalRawStatSum(log_rsb,x,y)
-#define LOG_CLEAR_DYN_STAT(x) \
-do { \
- RecSetRawStatSum(log_rsb, x, 0); \
- RecSetRawStatCount(log_rsb, x, 0); \
-} while (0);
-
-#define LOG_ConfigReadInteger REC_ConfigReadInteger
-#define LOG_LocalReadInteger REC_ConfigReadInteger
-#define LOG_ConfigReadString REC_ConfigReadString
-#define LOG_RegisterConfigUpdateFunc REC_RegisterConfigUpdateFunc
-#define LOG_RegisterLocalUpdateFunc REC_RegisterConfigUpdateFunc
-#define LOG_RegisterMgmtCallback RecRegisterManagerCb
-
-
struct dirent;
#if defined(IOCORE_LOG_COLLATION)
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9d2acd0a/proxy/logging/LogFile.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogFile.cc b/proxy/logging/LogFile.cc
index 6b93a26..c27dc20 100644
--- a/proxy/logging/LogFile.cc
+++ b/proxy/logging/LogFile.cc
@@ -275,10 +275,9 @@ LogFile::open_file()
writeln(m_header, strlen(m_header), m_fd, m_name);
}
}
- // we use SUM_GLOBAL_DYN_STAT because INCREMENT_DYN_STAT
- // would increment only the statistics for the flush thread (where we
- // are running) and these won't be visible Traffic Manager
- LOG_SUM_GLOBAL_DYN_STAT(log_stat_log_files_open_stat, 1);
+
+ RecIncrRawStat(log_rsb, this_thread()->mutex->thread_holding,
+ log_stat_log_files_open_stat, 1);
return LOG_FILE_NO_ERROR;
}
@@ -297,10 +296,8 @@ LogFile::close_file()
Debug("log-file", "LogFile %s (fd=%d) is closed", m_name, m_fd);
m_fd = -1;
- // we use SUM_GLOBAL_DYN_STAT because DECREMENT_DYN_STAT
- // would decrement only the statistics for the flush thread (where we
- // are running) and these won't be visible in Traffic Manager
- LOG_SUM_GLOBAL_DYN_STAT(log_stat_log_files_open_stat, -1);
+ RecIncrRawStat(log_rsb, this_thread()->mutex->thread_holding,
+ log_stat_log_files_open_stat, -1);
}
}
@@ -521,6 +518,14 @@ LogFile::preproc_and_try_delete(LogBuffer * lb)
//
LogFlushData *flush_data = new LogFlushData(this, lb);
+ ProxyMutex *mutex = this_thread()->mutex;
+
+ RecIncrRawStat(log_rsb, mutex->thread_holding, log_stat_num_flush_to_disk_stat,
+ lb->header()->entry_count);
+
+ RecIncrRawStat(log_rsb, mutex->thread_holding, log_stat_bytes_flush_to_disk_stat,
+ lb->header()->byte_count);
+
ink_atomiclist_push(Log::flush_data_list, flush_data);
Log::flush_notify->signal();
@@ -625,6 +630,7 @@ LogFile::write_ascii_logbuffer3(LogBufferHeader * buffer_header, char *alt_forma
LogBufferIterator iter(buffer_header);
LogEntryHeader *entry_header;
+ int fmt_entry_count = 0;
int fmt_buf_bytes = 0;
int total_bytes = 0;
@@ -647,6 +653,7 @@ LogFile::write_ascii_logbuffer3(LogBufferHeader * buffer_header, char *alt_forma
}
while ((entry_header = iter.next())) {
+ fmt_entry_count = 0;
fmt_buf_bytes = 0;
if (m_file_format == ASCII_PIPE)
@@ -673,6 +680,7 @@ LogFile::write_ascii_logbuffer3(LogBufferHeader * buffer_header, char *alt_forma
fmt_buf_bytes += bytes;
ascii_buffer[fmt_buf_bytes] = '\n';
++fmt_buf_bytes;
+ ++fmt_entry_count;
} else {
Error("Failed to convert LogBuffer to ascii, have dropped (%" PRIu32 ") bytes.",
entry_header->entry_len);
@@ -691,6 +699,15 @@ LogFile::write_ascii_logbuffer3(LogBufferHeader * buffer_header, char *alt_forma
// send the buffer to flush thread
//
LogFlushData *flush_data = new LogFlushData(this, ascii_buffer, fmt_buf_bytes);
+
+ ProxyMutex *mutex = this_thread()->mutex;
+
+ RecIncrRawStat(log_rsb, mutex->thread_holding, log_stat_num_flush_to_disk_stat,
+ fmt_entry_count);
+
+ RecIncrRawStat(log_rsb, mutex->thread_holding, log_stat_bytes_flush_to_disk_stat,
+ fmt_buf_bytes);
+
ink_atomiclist_push(Log::flush_data_list, flush_data);
Log::flush_notify->signal();
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9d2acd0a/proxy/logging/LogObject.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogObject.cc b/proxy/logging/LogObject.cc
index ff7418d..7bcbf9f 100644
--- a/proxy/logging/LogObject.cc
+++ b/proxy/logging/LogObject.cc
@@ -517,8 +517,6 @@ int
LogObject::log(LogAccess * lad, char *text_entry)
{
LogBuffer *buffer;
- // mutex used for the statistics (used in LOG_INCREMENT_DYN_STAT macro)
- ProxyMutex *mutex = this_ethread()->mutex;
size_t offset = 0; // prevent warning
size_t bytes_needed = 0, bytes_used = 0;
@@ -526,14 +524,13 @@ LogObject::log(LogAccess * lad, char *text_entry)
// likewise, send data to a remote client even if local space is exhausted
// (if there is a remote client, m_logFile will be NULL
if (Log::config->logging_space_exhausted && !writes_to_pipe() && m_logFile) {
- LOG_INCREMENT_DYN_STAT(log_stat_event_log_access_fail_stat);
+ Note("logging space exhausted, can't write to:%s, drop this entry", m_logFile->m_name);
return Log::FULL;
}
// this verification must be done here in order to avoid 'dead' LogBuffers
// with none zero 'in usage' counters (see _checkout_write for more details)
if (!lad && !text_entry) {
Note("Call to LogAccess without LAD or text entry; skipping");
- LOG_INCREMENT_DYN_STAT(log_stat_event_log_access_fail_stat);
return Log::FAIL;
}
@@ -541,7 +538,6 @@ LogObject::log(LogAccess * lad, char *text_entry)
if (lad && m_filter_list.toss_this_entry(lad)) {
Debug("log", "entry filtered, skipping ...");
- LOG_INCREMENT_DYN_STAT(log_stat_event_log_access_skip_stat);
return Log::SKIP;
}
@@ -550,7 +546,6 @@ LogObject::log(LogAccess * lad, char *text_entry)
// LogFormat object for aggregate formats
if (m_format->m_agg_marshal_space == NULL) {
Note("No temp space to marshal aggregate fields into");
- LOG_INCREMENT_DYN_STAT(log_stat_event_log_access_fail_stat);
return Log::FAIL;
}
@@ -574,7 +569,7 @@ LogObject::log(LogAccess * lad, char *text_entry)
if (time_now < m_format->m_interval_next) {
Debug("log-agg", "Time now = %ld, next agg = %ld; not time "
"for aggregate entry", time_now, m_format->m_interval_next);
- return Log::LOG_OK;
+ return Log::AGGR;
}
// can easily compute bytes_needed because all fields are INTs
// and will use INK_MIN_ALIGN each
@@ -587,17 +582,15 @@ LogObject::log(LogAccess * lad, char *text_entry)
if (bytes_needed == 0) {
Debug("log-buffer", "Nothing to log, bytes_needed = 0");
- LOG_INCREMENT_DYN_STAT(log_stat_event_log_access_skip_stat);
return Log::SKIP;
}
- // Now try to place this entry in the current LogBuffer.
+ // Now try to place this entry in the current LogBuffer.
buffer = _checkout_write(&offset, bytes_needed);
if (!buffer) {
- Note("Traffic Server is skipping the current log entry for %s because "
- "its size (%zu) exceeds the maximum payload space in a " "log buffer", m_basename, bytes_needed);
- LOG_INCREMENT_DYN_STAT(log_stat_event_log_access_fail_stat);
+ Note("Skipping the current log entry for %s because its size (%zu) exceeds "
+ "the maximum payload space in a log buffer", m_basename, bytes_needed);
return Log::FAIL;
}
//
@@ -622,8 +615,6 @@ LogObject::log(LogAccess * lad, char *text_entry)
buffer->checkin_write(offset);
- LOG_INCREMENT_DYN_STAT(log_stat_event_log_access_stat);
-
return Log::LOG_OK;
}
@@ -1301,3 +1292,47 @@ LogObjectManager::transfer_objects(LogObjectManager & old_mgr)
display();
}
}
+
+int
+LogObjectManager::log(LogAccess * lad)
+{
+ int ret = Log::SKIP;
+ ProxyMutex *mutex = this_thread()->mutex;
+
+ 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);
+ }
+
+ //
+ // The bit-field code in *ret* are priority chain:
+ // FAIL > FULL > LOG_OK > AGGR > SKIP
+ // The if-statement should keep step with the priority order.
+ //
+ if (unlikely(ret & Log::FAIL)) {
+ RecIncrRawStat(log_rsb, mutex->thread_holding,
+ log_stat_event_log_access_fail_stat, 1);
+ } else if (unlikely(ret & Log::FULL)) {
+ RecIncrRawStat(log_rsb, mutex->thread_holding,
+ log_stat_event_log_access_full_stat, 1);
+ } else if (likely(ret & Log::LOG_OK)) {
+ RecIncrRawStat(log_rsb, mutex->thread_holding,
+ log_stat_event_log_access_ok_stat, 1);
+ } else if (unlikely(ret & Log::AGGR)) {
+ RecIncrRawStat(log_rsb, mutex->thread_holding,
+ log_stat_event_log_access_aggr_stat, 1);
+ } else if (likely(ret & Log::SKIP)) {
+ RecIncrRawStat(log_rsb, mutex->thread_holding,
+ log_stat_event_log_access_skip_stat, 1);
+ } else
+ ink_release_assert("Unexpected result");
+
+ return ret;
+}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9d2acd0a/proxy/logging/LogObject.h
----------------------------------------------------------------------
diff --git a/proxy/logging/LogObject.h b/proxy/logging/LogObject.h
index 1f19b4f..49f426a 100644
--- a/proxy/logging/LogObject.h
+++ b/proxy/logging/LogObject.h
@@ -402,24 +402,6 @@ inline int LogObjectManager::roll_files(long time_now)
return num_rolled;
};
-inline int
-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;
-}
-
inline void
LogObjectManager::display(FILE * str)
{