You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2011/03/18 20:04:55 UTC
svn commit: r1083018 [2/2] - in /trafficserver/traffic/trunk: ./ mgmt/
mgmt/api/ mgmt/api/include/ mgmt/api/remote/ mgmt/cli/ mgmt/web2/ proxy/
proxy/config/ proxy/logging/
Modified: trafficserver/traffic/trunk/proxy/logging/LogBuffer.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogBuffer.cc?rev=1083018&r1=1083017&r2=1083018&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogBuffer.cc (original)
+++ trafficserver/traffic/trunk/proxy/logging/LogBuffer.cc Fri Mar 18 19:04:53 2011
@@ -608,7 +608,6 @@ LogBuffer::update_header_data()
This static function simply returns the greatest number of bytes than an
entry can be and fit into a LogBuffer.
-------------------------------------------------------------------------*/
-
size_t LogBuffer::max_entry_bytes()
{
return (Log::config->log_buffer_size - sizeof(LogBufferHeader));
@@ -617,7 +616,6 @@ size_t LogBuffer::max_entry_bytes()
/*-------------------------------------------------------------------------
LogBuffer::resolve_custom_entry
-------------------------------------------------------------------------*/
-
int
LogBuffer::resolve_custom_entry(LogFieldList * fieldlist,
char *printf_str, char *read_from, char *write_to,
@@ -665,6 +663,7 @@ LogBuffer::resolve_custom_entry(LogField
int printf_len = (int)::strlen(printf_str); // OPTIMIZE
int bytes_written = 0;
int res, i;
+
const char *buffer_size_exceeded_msg =
"Traffic Server is skipping the current log entry because its size "
"exceeds the maximum line (entry) size for an ascii log buffer";
@@ -677,7 +676,6 @@ LogBuffer::resolve_custom_entry(LogField
// for timestamps that are not aggregates, we take the
// value from the function argument; otherwise we use the
// unmarshaling function
-
bool non_aggregate_timestamp = false;
if (field->aggregate() == LogField::NO_AGGREGATE) {
@@ -809,7 +807,6 @@ LogBuffer::resolve_custom_entry(LogField
space provided, and returns the length of the new string (not including
trailing null, like strlen).
-------------------------------------------------------------------------*/
-
int
LogBuffer::to_ascii(LogEntryHeader * entry, LogFormatType type,
char *buf, int buf_len, char *symbol_str, char *printf_str,
Modified: trafficserver/traffic/trunk/proxy/logging/LogConfig.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogConfig.cc?rev=1083018&r1=1083017&r2=1083018&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogConfig.cc (original)
+++ trafficserver/traffic/trunk/proxy/logging/LogConfig.cc Fri Mar 18 19:04:53 2011
@@ -55,7 +55,6 @@
#include "InkXml.h"
#include "LogFormatType.h"
-#include "LogLimits.h"
#include "LogField.h"
#include "LogFilter.h"
#include "LogFormat.h"
@@ -241,6 +240,7 @@ LogConfig::read_configuration_variables(
max_space_mb_headroom = val;
};
+ // TODO: We should mover this "parser" to lib/ts
ptr = LOG_ConfigReadString("proxy.config.log.logfile_perm");
if (ptr && strlen(ptr) == 9) {
logfile_perm = 0;
@@ -1314,18 +1314,12 @@ LogConfig::register_mgmt_callbacks()
bool LogConfig::space_to_write(int64_t bytes_to_write)
{
- int64_t
- config_space,
- partition_headroom;
- int64_t
- logical_space_used,
- physical_space_left;
- bool
- space;
+ int64_t config_space, partition_headroom;
+ int64_t logical_space_used, physical_space_left;
+ bool space;
config_space = (int64_t) get_max_space_mb() * LOG_MEGABYTE;
- partition_headroom = (int64_t) PARTITION_HEADROOM_MB *
- LOG_MEGABYTE;
+ partition_headroom = (int64_t) PARTITION_HEADROOM_MB * LOG_MEGABYTE;
logical_space_used = m_space_used + bytes_to_write;
physical_space_left = m_partition_space_left - (int64_t) bytes_to_write;
Modified: trafficserver/traffic/trunk/proxy/logging/LogConfig.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogConfig.h?rev=1083018&r1=1083017&r2=1083018&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogConfig.h (original)
+++ trafficserver/traffic/trunk/proxy/logging/LogConfig.h Fri Mar 18 19:04:53 2011
@@ -144,8 +144,8 @@ public:
MIN_ROLLING_INTERVAL_SEC = 300
};
- LogConfig();
- ~LogConfig();
+ LogConfig();
+ ~LogConfig();
void init(LogConfig * previous_config = 0);
void display(FILE * fd = stdout);
@@ -158,38 +158,31 @@ public:
static void register_stat_callbacks();
static void register_mgmt_callbacks();
- bool am_collation_host()
- {
- return collation_mode == COLLATION_HOST;
- };
bool space_to_write(int64_t bytes_to_write);
- bool space_is_short()
- {
- return !space_to_write(max_space_mb_headroom * LOG_MEGABYTE);
- };
- void increment_space_used(int bytes)
- {
+
+ bool am_collation_host() const { return collation_mode == COLLATION_HOST; }
+ bool space_is_short() { return !space_to_write(max_space_mb_headroom * LOG_MEGABYTE); };
+
+ void increment_space_used(int bytes) {
m_space_used += bytes;
m_partition_space_left -= bytes;
- };
+ }
+
void update_space_used();
void read_configuration_variables();
// CVR This is the mgmt callback function, hence all the strange arguments
static void *reconfigure_mgmt_variables(void *token, char *data_raw, int data_len);
- int get_max_space_mb()
- {
+ int get_max_space_mb() {
return (use_orphan_log_space_value ? max_space_mb_for_orphan_logs : max_space_mb_for_logs);
- };
- void transfer_objects(LogConfig * old_config)
- {
+ }
+
+ void transfer_objects(LogConfig * old_config) {
log_object_manager.transfer_objects(old_config->log_object_manager);
- };
- bool has_api_objects()
- {
- return log_object_manager.has_api_objects();
- };
+ }
+
+ bool has_api_objects() const { return log_object_manager.has_api_objects(); }
public:
bool initialized;
@@ -280,8 +273,7 @@ private:
PreDefinedFormatInfo(LogFormat * fmt, char *fname, int ascii,
char *hdr):format(fmt), filename(fname), is_ascii(ascii), header(hdr)
- {
- };
+ { }
};
Modified: trafficserver/traffic/trunk/proxy/logging/LogConfigCollation.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogConfigCollation.cc?rev=1083018&r1=1083017&r2=1083018&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogConfigCollation.cc (original)
+++ trafficserver/traffic/trunk/proxy/logging/LogConfigCollation.cc Fri Mar 18 19:04:53 2011
@@ -32,7 +32,6 @@
#include "ink_platform.h"
#include "LogFormatType.h"
-#include "LogLimits.h"
#include "LogField.h"
#include "LogFilter.h"
#include "LogFormat.h"
Modified: trafficserver/traffic/trunk/proxy/logging/LogField.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogField.cc?rev=1083018&r1=1083017&r2=1083018&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogField.cc (original)
+++ trafficserver/traffic/trunk/proxy/logging/LogField.cc Fri Mar 18 19:04:53 2011
@@ -26,8 +26,6 @@
This file implements the LogField object, which is the central
representation of a logging field.
-
-
***************************************************************************/
#include "libts.h"
@@ -70,12 +68,10 @@ const char *aggregate_names[] = {
-------------------------------------------------------------------------*/
// Generic field ctor
-
LogField::LogField(const char *name, const char *symbol, Type type, MarshalFunc marshal, UnmarshalFunc unmarshal)
- :
- m_name(xstrdup(name)), m_symbol(xstrdup(symbol)), m_type(type), m_container(NO_CONTAINER), m_marshal_func(marshal),
- m_unmarshal_func(unmarshal), m_unmarshal_func_map(NULL), m_agg_op(NO_AGGREGATE), m_agg_cnt(0), m_agg_val(0),
- m_time_field(false), m_alias_map(0)
+ : m_name(xstrdup(name)), m_symbol(xstrdup(symbol)), m_type(type), m_container(NO_CONTAINER), m_marshal_func(marshal),
+ m_unmarshal_func(unmarshal), m_unmarshal_func_map(NULL), m_agg_op(NO_AGGREGATE), m_agg_cnt(0), m_agg_val(0),
+ m_time_field(false), m_alias_map(0)
{
ink_assert(m_name != NULL);
ink_assert(m_symbol != NULL);
@@ -90,10 +86,9 @@ LogField::LogField(const char *name, con
LogField::LogField(const char *name, const char *symbol, Type type,
MarshalFunc marshal, UnmarshalFuncWithMap unmarshal, Ptr<LogFieldAliasMap> map)
- :
- m_name(xstrdup(name)), m_symbol(xstrdup(symbol)), m_type(type), m_container(NO_CONTAINER), m_marshal_func(marshal),
- m_unmarshal_func(NULL), m_unmarshal_func_map(unmarshal), m_agg_op(NO_AGGREGATE), m_agg_cnt(0), m_agg_val(0),
- m_time_field(false), m_alias_map(map)
+ : m_name(xstrdup(name)), m_symbol(xstrdup(symbol)), m_type(type), m_container(NO_CONTAINER), m_marshal_func(marshal),
+ m_unmarshal_func(NULL), m_unmarshal_func_map(unmarshal), m_agg_op(NO_AGGREGATE), m_agg_cnt(0), m_agg_val(0),
+ m_time_field(false), m_alias_map(map)
{
ink_assert(m_name != NULL);
ink_assert(m_symbol != NULL);
@@ -108,32 +103,10 @@ LogField::LogField(const char *name, con
}
// Container field ctor
-
LogField::LogField(const char *field, Container container)
- :
-m_name(xstrdup(field))
- ,
-m_symbol(xstrdup(container_names[container]))
- ,
-m_type(LogField::STRING)
- ,
-m_container(container)
- ,
-m_marshal_func(NULL)
- ,
-m_unmarshal_func(NULL)
- ,
-m_unmarshal_func_map(NULL)
- ,
-m_agg_op(NO_AGGREGATE)
- ,
-m_agg_cnt(0)
- ,
-m_agg_val(0)
- ,
-m_time_field(false)
- ,
-m_alias_map(0)
+ : m_name(xstrdup(field)), m_symbol(xstrdup(container_names[container])), m_type(LogField::STRING),
+ m_container(container), m_marshal_func(NULL), m_unmarshal_func(NULL), m_unmarshal_func_map(NULL),
+ m_agg_op(NO_AGGREGATE), m_agg_cnt(0), m_agg_val(0), m_time_field(false), m_alias_map(0)
{
ink_assert(m_name != NULL);
ink_assert(m_symbol != NULL);
@@ -145,7 +118,6 @@ m_alias_map(0)
|| strcmp(m_symbol, "cqtn") == 0 || strcmp(m_symbol, "cqtd") == 0 || strcmp(m_symbol, "cqtt") == 0);
switch (m_container) {
-
case CQH:
case PSH:
case PQH:
@@ -172,32 +144,10 @@ m_alias_map(0)
}
// Copy ctor
-
-LogField::LogField(const LogField & rhs)
- :
-m_name(xstrdup(rhs.m_name))
- ,
-m_symbol(xstrdup(rhs.m_symbol))
- ,
-m_type(rhs.m_type)
- ,
-m_container(rhs.m_container)
- ,
-m_marshal_func(rhs.m_marshal_func)
- ,
-m_unmarshal_func(rhs.m_unmarshal_func)
- ,
-m_unmarshal_func_map(rhs.m_unmarshal_func_map)
- ,
-m_agg_op(rhs.m_agg_op)
- ,
-m_agg_cnt(0)
- ,
-m_agg_val(0)
- ,
-m_time_field(rhs.m_time_field)
- ,
-m_alias_map(rhs.m_alias_map)
+LogField::LogField(const LogField &rhs)
+ : m_name(xstrdup(rhs.m_name)), m_symbol(xstrdup(rhs.m_symbol)), m_type(rhs.m_type), m_container(rhs.m_container),
+ m_marshal_func(rhs.m_marshal_func), m_unmarshal_func(rhs.m_unmarshal_func), m_unmarshal_func_map(rhs.m_unmarshal_func_map),
+ m_agg_op(rhs.m_agg_op), m_agg_cnt(0), m_agg_val(0), m_time_field(rhs.m_time_field), m_alias_map(rhs.m_alias_map)
{
ink_assert(m_name != NULL);
ink_assert(m_symbol != NULL);
@@ -207,7 +157,6 @@ m_alias_map(rhs.m_alias_map)
/*-------------------------------------------------------------------------
LogField::~LogField
-------------------------------------------------------------------------*/
-
LogField::~LogField()
{
xfree(m_name);
@@ -222,13 +171,11 @@ LogField::~LogField()
marshalling routines that if the marshal buffer is NULL, only the size
requirement is returned.
-------------------------------------------------------------------------*/
-
unsigned
-LogField::marshal_len(LogAccess * lad)
+LogField::marshal_len(LogAccess *lad)
{
- if (m_container == NO_CONTAINER) {
+ if (m_container == NO_CONTAINER)
return (lad->*m_marshal_func) (NULL);
- }
switch (m_container) {
case CQH:
@@ -262,9 +209,8 @@ LogField::marshal_len(LogAccess * lad)
This routine will marshsal the given field into the buffer provided.
-------------------------------------------------------------------------*/
-
unsigned
-LogField::marshal(LogAccess * lad, char *buf)
+LogField::marshal(LogAccess *lad, char *buf)
{
if (m_container == NO_CONTAINER) {
return (lad->*m_marshal_func) (buf);
@@ -300,7 +246,6 @@ LogField::marshal(LogAccess * lad, char
/*-------------------------------------------------------------------------
LogField::marshal_agg
-------------------------------------------------------------------------*/
-
unsigned
LogField::marshal_agg(char *buf)
{
@@ -343,7 +288,6 @@ LogField::marshal_agg(char *buf)
This routine will invoke the proper unmarshalling routine to return a
string that represents the ASCII value of the field.
-------------------------------------------------------------------------*/
-
unsigned
LogField::unmarshal(char **buf, char *dest, int len)
{
@@ -357,9 +301,8 @@ LogField::unmarshal(char **buf, char *de
/*-------------------------------------------------------------------------
LogField::display
-------------------------------------------------------------------------*/
-
void
-LogField::display(FILE * fd)
+LogField::display(FILE *fd)
{
static const char *names[LogField::N_TYPES] = {
"sINT",
@@ -372,7 +315,6 @@ LogField::display(FILE * fd)
/*-------------------------------------------------------------------------
-------------------------------------------------------------------------*/
-
void
LogField::set_aggregate_op(LogField::Aggregate agg_op)
{
@@ -384,8 +326,6 @@ LogField::set_aggregate_op(LogField::Agg
}
}
-/*-------------------------------------------------------------------------
- -------------------------------------------------------------------------*/
void
LogField::update_aggregate(int64_t val)
@@ -420,8 +360,6 @@ LogField::update_aggregate(int64_t val)
"new val = %d, cnt = %d", m_symbol, val, m_agg_val, m_agg_cnt);
}
-/*-------------------------------------------------------------------------
- -------------------------------------------------------------------------*/
LogField::Container LogField::valid_container_name(char *name)
{
@@ -433,8 +371,6 @@ LogField::Container LogField::valid_cont
return LogField::NO_CONTAINER;
}
-/*-------------------------------------------------------------------------
- -------------------------------------------------------------------------*/
LogField::Aggregate LogField::valid_aggregate_name(char *name)
{
@@ -446,8 +382,6 @@ LogField::Aggregate LogField::valid_aggr
return LogField::NO_AGGREGATE;
}
-/*-------------------------------------------------------------------------
- -------------------------------------------------------------------------*/
bool LogField::fieldlist_contains_aggregates(char *fieldlist)
{
@@ -469,11 +403,9 @@ bool LogField::fieldlist_contains_aggreg
heap with "new" and that each element is on at most ONE list. To enforce
this, items are copied by default, using the copy ctor.
-------------------------------------------------------------------------*/
-
LogFieldList::LogFieldList()
-:m_marshal_len(0)
-{
-}
+ : m_marshal_len(0)
+{ }
LogFieldList::~LogFieldList()
{
@@ -491,7 +423,7 @@ LogFieldList::clear()
}
void
-LogFieldList::add(LogField * field, bool copy)
+LogFieldList::add(LogField *field, bool copy)
{
ink_assert(field != NULL);
@@ -509,7 +441,7 @@ LogFieldList::add(LogField * field, bool
LogField *
LogFieldList::find_by_name(const char *name) const
{
- for (LogField * f = first(); f; f = next(f)) {
+ for (LogField *f = first(); f; f = next(f)) {
if (!strcmp(f->name(), name)) {
return f;
}
@@ -540,10 +472,10 @@ LogFieldList::find_by_symbol(const char
}
unsigned
-LogFieldList::marshal_len(LogAccess * lad)
+LogFieldList::marshal_len(LogAccess *lad)
{
int bytes = 0;
- for (LogField * f = first(); f; f = next(f)) {
+ for (LogField *f = first(); f; f = next(f)) {
if (f->type() != LogField::sINT) {
bytes += f->marshal_len(lad);
}
@@ -552,11 +484,11 @@ LogFieldList::marshal_len(LogAccess * la
}
unsigned
-LogFieldList::marshal(LogAccess * lad, char *buf)
+LogFieldList::marshal(LogAccess *lad, char *buf)
{
char *ptr;
int bytes = 0;
- for (LogField * f = first(); f; f = next(f)) {
+ for (LogField *f = first(); f; f = next(f)) {
ptr = &buf[bytes];
bytes += f->marshal(lad, ptr);
ink_debug_assert(bytes % INK_MIN_ALIGN == 0);
@@ -569,7 +501,7 @@ LogFieldList::marshal_agg(char *buf)
{
char *ptr;
int bytes = 0;
- for (LogField * f = first(); f; f = next(f)) {
+ for (LogField *f = first(); f; f = next(f)) {
ptr = &buf[bytes];
bytes += f->marshal_agg(ptr);
}
@@ -580,16 +512,16 @@ unsigned
LogFieldList::count()
{
unsigned cnt = 0;
- for (LogField * f = first(); f; f = next(f)) {
+ for (LogField *f = first(); f; f = next(f)) {
cnt++;
}
return cnt;
}
void
-LogFieldList::display(FILE * fd)
+LogFieldList::display(FILE *fd)
{
- for (LogField * f = first(); f; f = next(f)) {
+ for (LogField *f = first(); f; f = next(f)) {
f->display(fd);
}
}
Modified: trafficserver/traffic/trunk/proxy/logging/LogFieldAliasMap.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogFieldAliasMap.h?rev=1083018&r1=1083017&r2=1083018&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogFieldAliasMap.h (original)
+++ trafficserver/traffic/trunk/proxy/logging/LogFieldAliasMap.h Fri Mar 18 19:04:53 2011
@@ -103,28 +103,28 @@ struct LogFieldAliasTableEntry
bool valid; // entry in table is valid
char *name; // the string equivalent
size_t length; // the length of the string
- LogFieldAliasTableEntry():valid(false), name(NULL), length(0)
- {
- };
+
+ LogFieldAliasTableEntry()
+ : valid(false), name(NULL), length(0)
+ { }
};
class LogFieldAliasTable:public LogFieldAliasMap
{
private:
-
size_t m_min; // minimum numeric value
size_t m_max; // maximum numeric value
size_t m_entries; // number of entries in table
LogFieldAliasTableEntry *m_table; // array of table entries
public:
+ LogFieldAliasTable()
+ : m_min(0), m_max(0), m_entries(0), m_table(0)
+ { }
- LogFieldAliasTable():m_min(0), m_max(0), m_entries(0), m_table(0)
- {
- };
~LogFieldAliasTable() {
delete[]m_table;
- };
+ }
void init(size_t numPairs, ...);
@@ -154,7 +154,7 @@ public:
}
return retVal;
- };
+ }
int asString(IntType key, char *buf, size_t bufLen, size_t * numCharsPtr = 0) const
{
@@ -183,15 +183,13 @@ public:
*numCharsPtr = numChars;
}
return retVal;
- };
+ }
};
/*****************************************************************************
-
The LogFieldAliasIP class implements a LogFieldAliasMap that converts IP
addresses from their integer value to the "dot" notation and back.
-
*****************************************************************************/
class LogFieldAliasIP:public LogFieldAliasMap
@@ -209,31 +207,11 @@ public:
{
return INVALID_STRING;
}
- };
+ }
int asString(IntType ip, char *buf, size_t bufLen, size_t * numCharsPtr = 0) const
{
return (LogUtils::ip_to_str(ip, buf, bufLen, numCharsPtr) ? BUFFER_TOO_SMALL : ALL_OK);
-/*
- int retVal;
- size_t numChars;
- size_t n = snprintf (buf, bufLen, "%u.%u.%u.%u",
- (ip >> 24) & 0xff,
- (ip >> 16) & 0xff,
- (ip >> 8) & 0xff,
- ip & 0xff);
- if (n < bufLen) {
- numChars = n;
- retVal = ALL_OK;
- } else {
- numChars = bufLen - 1;
- retVal = BUFFER_TOO_SMALL;
- }
- if (numCharsPtr) {
- *numCharsPtr = numChars;
- }
- return retVal;
-*/
};
};
@@ -259,13 +237,12 @@ public:
{
return INVALID_STRING;
}
- };
+ }
int asString(IntType ip, char *buf, size_t bufLen, size_t * numCharsPtr = 0) const
{
-
return (LogUtils::timestamp_to_hex_str(ip, buf, bufLen, numCharsPtr) ? BUFFER_TOO_SMALL : ALL_OK);
- };
+ }
};
/*****************************************************************************
@@ -290,12 +267,12 @@ public:
{
return INVALID_STRING;
}
- };
+ }
int asString(IntType time, char *buf, size_t bufLen, size_t * numCharsPtr = 0) const
{
return (LogUtils::timestamp_to_hex_str(time, buf, bufLen, numCharsPtr) ? BUFFER_TOO_SMALL : ALL_OK);
- };
+ }
};
Modified: trafficserver/traffic/trunk/proxy/logging/LogFile.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogFile.cc?rev=1083018&r1=1083017&r2=1083018&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogFile.cc (original)
+++ trafficserver/traffic/trunk/proxy/logging/LogFile.cc Fri Mar 18 19:04:53 2011
@@ -41,7 +41,6 @@
#include "I_Machine.h"
#include "LogSock.h"
-#include "LogLimits.h"
#include "LogField.h"
#include "LogFilter.h"
#include "LogFormat.h"
@@ -610,7 +609,6 @@ LogFile::write_ascii_logbuffer(LogBuffer
}
while ((entry_header = iter.next())) {
-
fmt_line_bytes = LogBuffer::to_ascii(entry_header, format_type,
&fmt_line[0], LOG_MAX_FORMATTED_LINE,
fieldlist_str, printf_str, buffer_header->version, alt_format);
@@ -947,8 +945,7 @@ MetaInfo::_read_from_file()
"\tsignature string = %s\n" "\tsignature value = %" PRIu64 "", _filename, t, _log_object_signature);
}
} else if (line_number == 1) {
- _creation_time = (time_t) atol(t);
- _flags |= PRE_PANDA_METAFILE | VALID_CREATION_TIME;
+ ink_release_assert(!"no panda support");
}
}
++line_number;
Modified: trafficserver/traffic/trunk/proxy/logging/LogFile.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogFile.h?rev=1083018&r1=1083017&r2=1083018&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogFile.h (original)
+++ trafficserver/traffic/trunk/proxy/logging/LogFile.h Fri Mar 18 19:04:53 2011
@@ -45,9 +45,7 @@ class LogObject;
MetaInfo
Meta information for LogFile
-
-------------------------------------------------------------------------*/
-
class MetaInfo
{
public:
@@ -57,9 +55,8 @@ public:
// from metafile
VALID_CREATION_TIME = 2, // creation time is valid
VALID_SIGNATURE = 4, // signature is valid
- PRE_PANDA_METAFILE = 8, // metafile has pre-Panda format
// (i.e., creation time only)
- FILE_OPEN_SUCCESSFUL = 16 // metafile was opened successfully
+ FILE_OPEN_SUCCESSFUL = 8 // metafile was opened successfully
};
enum
@@ -83,7 +80,7 @@ public:
{
_build_name(filename);
_read_from_file();
- };
+ }
MetaInfo(char *filename, time_t creation, uint64_t signature):_creation_time(creation),
_log_object_signature(signature), _flags(VALID_CREATION_TIME | VALID_SIGNATURE)
@@ -91,7 +88,7 @@ public:
_build_name(filename);
_write_to_file();
- };
+ }
~MetaInfo() {
xfree(_filename);
@@ -105,7 +102,8 @@ public:
} else {
return false;
}
- };
+ }
+
bool get_log_object_signature(uint64_t * signature)
{
if (_flags & VALID_SIGNATURE) {
@@ -114,19 +112,10 @@ public:
} else {
return false;
}
- };
- bool data_from_metafile()
- {
- return (_flags & DATA_FROM_METAFILE ? true : false);
- };
- bool pre_panda_metafile()
- {
- return (_flags & PRE_PANDA_METAFILE ? true : false);
- };
- bool file_open_successful()
- {
- return (_flags & FILE_OPEN_SUCCESSFUL ? true : false);
- };
+ }
+
+ bool data_from_metafile() const { return (_flags & DATA_FROM_METAFILE ? true : false); }
+ bool file_open_successful() { return (_flags & FILE_OPEN_SUCCESSFUL ? true : false); }
};
/*-------------------------------------------------------------------------
@@ -142,10 +131,11 @@ public:
#ifndef TS_MICRO
size_t ascii_buffer_size = 4 * 9216, size_t max_line_size = 9216,
#else
- size_t ascii_buffer_size = 1024, size_t max_line_size = 1024);
+ size_t ascii_buffer_size = 1024, size_t max_line_size = 1024,
#endif
- size_t overspill_report_count = 1000);
- ~ LogFile();
+ size_t overspill_report_count = 1000);
+
+ ~LogFile();
enum
{
@@ -159,20 +149,17 @@ public:
int write(LogBuffer * lb, size_t * to_disk = 0, size_t * to_net = 0, size_t * to_pipe = 0);
int roll(long interval_start, long interval_end);
- char *get_name()
- {
- return m_name;
- }
+
+ char *get_name() const { return m_name; }
+
void change_header(const char *header);
void change_name(char *new_name);
- LogFileFormat get_format()
- {
- return m_file_format;
- };
- const char *get_format_name()
- {
+
+ LogFileFormat get_format() const { return m_file_format; }
+ const char *get_format_name() const {
return (m_file_format == BINARY_LOG ? "binary" : (m_file_format == ASCII_PIPE ? "ascii_pipe" : "ascii"));
- };
+ }
+
static int write_ascii_logbuffer(LogBufferHeader * buffer_header, int fd, const char *path, char *alt_format = NULL);
int write_ascii_logbuffer3(LogBufferHeader * buffer_header, char *alt_format = NULL);
static bool rolled_logfile(char *file);
@@ -180,18 +167,17 @@ public:
void display(FILE * fd = stdout);
int open_file();
- bool size_limit_exceeded()
- {
+
+ bool size_limit_exceeded() {
if (!m_filesystem_checks_done) {
do_filesystem_checks();
}
return (m_has_size_limit ? (uint64_t) m_size_bytes > m_size_limit_bytes : false);
- };
+ }
+
int do_filesystem_checks();
- off_t get_size_bytes()const
- {
- return m_size_bytes;
- };
+
+ off_t get_size_bytes() const { return m_size_bytes; };
private:
void init();
Modified: trafficserver/traffic/trunk/proxy/logging/LogFilter.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogFilter.h?rev=1083018&r1=1083017&r2=1083018&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogFilter.h (original)
+++ trafficserver/traffic/trunk/proxy/logging/LogFilter.h Fri Mar 18 19:04:53 2011
@@ -38,11 +38,9 @@
function which, given a LogAccess object, returns true if
the log entry is to be tossed out.
-------------------------------------------------------------------------*/
-
class LogFilter
{
public:
-
enum Type
{
INT_FILTER = 0,
@@ -73,7 +71,7 @@ public:
static const char *OPERATOR_NAME[];
LogFilter(const char *name, LogField * field, Action action, Operator oper);
- virtual ~ LogFilter();
+ virtual ~LogFilter();
char *name() const { return m_name; }
Type type() const { return m_type; }
@@ -83,10 +81,7 @@ public:
virtual void display(FILE * fd = stdout) = 0;
virtual void display_as_XML(FILE * fd = stdout) = 0;
- void reverse()
- {
- m_action = (m_action == REJECT ? ACCEPT : REJECT);
- };
+ void reverse() { m_action = (m_action == REJECT ? ACCEPT : REJECT); }
protected:
char *m_name;
@@ -111,7 +106,6 @@ private:
Filter for string fields.
-------------------------------------------------------------------------*/
-
class LogFilterString:public LogFilter
{
public:
@@ -166,7 +160,6 @@ private:
Filter for int fields.
-------------------------------------------------------------------------*/
-
class LogFilterInt:public LogFilter
{
public:
Modified: trafficserver/traffic/trunk/proxy/logging/LogFormat.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogFormat.h?rev=1083018&r1=1083017&r2=1083018&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogFormat.h (original)
+++ trafficserver/traffic/trunk/proxy/logging/LogFormat.h Fri Mar 18 19:04:53 2011
@@ -36,10 +36,6 @@
/*-------------------------------------------------------------------------
LogFormat
- Ok, as of 3.1, the role of the LogFormat object changes greatly. Before
- it was the central object in the logging system that defined each "file"
- that would be created, and all other objects hung off of it.
-
Now, this object will simply store the characteristics of a log format,
which is defined as a set of fields.
-------------------------------------------------------------------------*/
@@ -51,55 +47,23 @@ public:
LogFormat(const char *name, const char *format_str, unsigned interval_sec = 0);
LogFormat(const char *name, const char *fieldlist_str, const char *printf_str, unsigned interval_sec = 0);
LogFormat(const LogFormat & rhs);
+
~LogFormat();
void display(FILE * fd = stdout);
void displayAsXML(FILE * fd = stdout);
- bool valid()
- {
- return m_valid;
- }
- char *name()
- {
- return m_name_str;
- }
- char *fieldlist()
- {
- return m_fieldlist_str;
- }
- char *format_string()
- {
- return m_format_str;
- };
- int32_t name_id()
- {
- return m_name_id;
- }
- unsigned fieldlist_id()
- {
- return m_fieldlist_id;
- }
- LogFormatType type()
- {
- return m_format_type;
- }
- char *printf_str()
- {
- return m_printf_str;
- }
- bool is_aggregate()
- {
- return m_aggregate;
- }
- unsigned field_count()
- {
- return m_field_count;
- }
- long interval()
- {
- return m_interval_sec;
- };
+ bool valid() const { return m_valid; }
+ char *name() const { return m_name_str; }
+ char *fieldlist() const { return m_fieldlist_str; }
+ char *format_string() const { return m_format_str; }
+ int32_t name_id() const { return m_name_id; }
+ unsigned fieldlist_id() const { return m_fieldlist_id; }
+ LogFormatType type() const { return m_format_type; }
+ char *printf_str() const { return m_printf_str; }
+ bool is_aggregate() const { return m_aggregate; }
+ unsigned field_count() const { return m_field_count; }
+ long interval() const { return m_interval_sec; }
public:
static int32_t id_from_name(const char *name);
@@ -109,15 +73,8 @@ public:
static int parse_format_string(const char *format_str, char **printf_str, char **fields_str);
// these are static because m_tagging_on is a class variable
- //
- static void turn_tagging_on()
- {
- m_tagging_on = true;
- };
- static void turn_tagging_off()
- {
- m_tagging_on = false;
- };
+ static void turn_tagging_on() { m_tagging_on = true; }
+ static void turn_tagging_off() { m_tagging_on = false; }
private:
void setup(const char *name, const char *format_str, unsigned interval_sec = 0);
@@ -171,14 +128,9 @@ public:
LogFormat *find_by_name(const char *name) const;
LogFormat *find_by_type(LogFormatType type, int32_t id) const;
- LogFormat *first() const
- {
- return m_format_list.head;
- }
- LogFormat *next(LogFormat * here) const
- {
- return (here->link).next;
- }
+ LogFormat *first() const { return m_format_list.head; }
+ LogFormat *next(LogFormat * here) const { return (here->link).next; }
+
void clear();
unsigned count();
void display(FILE * fd = stdout);
Modified: trafficserver/traffic/trunk/proxy/logging/LogHost.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogHost.h?rev=1083018&r1=1083017&r2=1083018&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogHost.h (original)
+++ trafficserver/traffic/trunk/proxy/logging/LogHost.h Fri Mar 18 19:04:53 2011
@@ -20,30 +20,20 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
-
-
-
#ifndef LOG_HOST_H
#define LOG_HOST_H
class LogSock;
class LogBuffer;
-//#if defined(IOCORE_LOG_COLLATION)
-// ifdef removed so friend declaration won't break compile
-// friend needed so LogCollationClientSM will compile
class LogCollationClientSM;
-//#endif
#include "LogBufferSink.h"
/*-------------------------------------------------------------------------
LogHost
-
- This is a new addition to the Traffic Server logging as of the 3.1
- (Panda) release. This object corresponds to a named log collation host.
+ This object corresponds to a named log collation host.
-------------------------------------------------------------------------*/
-
-class LogHost:public LogBufferSink
+class LogHost: public LogBufferSink
{
//#if defined(IOCORE_LOG_COLLATION)
@@ -51,9 +41,9 @@ class LogHost:public LogBufferSink
//#endif
public:
- LogHost(char *object_filename, uint64_t object_signature);
- LogHost(const LogHost &);
- ~LogHost();
+ LogHost(char *object_filename, uint64_t object_signature);
+ LogHost(const LogHost &);
+ ~LogHost();
int set_name_or_ipstr(char *name_or_ipstr);
int set_ipstr_port(char *ipstr, unsigned int port);
@@ -64,33 +54,16 @@ public:
void disconnect();
int write(LogBuffer * lb, size_t * to_disk, size_t * to_net, size_t * to_pipe);
- char *name()
- {
- return (char *) ((m_name) ? m_name : "UNKNOWN");
- }
- unsigned port()
- {
- return m_port;
- }
- unsigned ip()
- {
- return m_ip;
- }
- char *ipstr()
- {
- return m_ipstr;
- };
+ char *name() const { return (char *) ((m_name) ? m_name : "UNKNOWN"); }
+ unsigned port() const { return m_port; }
+ unsigned ip() const { return m_ip; }
+ char *ipstr() const { return m_ipstr; }
void display(FILE * fd = stdout);
- LogFile *get_orphan_logfile()
- {
- return m_orphan_file;
- };
+
+ LogFile *get_orphan_logfile() const { return m_orphan_file; }
// check if we will be able to write orphan file
- int do_filesystem_checks()
- {
- return m_orphan_file->do_filesystem_checks();
- };
+ int do_filesystem_checks() { return m_orphan_file->do_filesystem_checks(); }
private:
void clear();
@@ -126,7 +99,6 @@ private:
/*-------------------------------------------------------------------------
LogHostList
-------------------------------------------------------------------------*/
-
class LogHostList:public LogBufferSink
{
public:
@@ -138,14 +110,8 @@ public:
void clear();
int write(LogBuffer * lb, size_t * to_disk = 0, size_t * to_net = 0, size_t * to_pipe = 0);
- LogHost *first()
- {
- return m_host_list.head;
- }
- LogHost *next(LogHost * here)
- {
- return (here->link).next;
- }
+ LogHost *first() { return m_host_list.head; }
+ LogHost *next(LogHost * here) { return (here->link).next; }
void display(FILE * fd = stdout);
bool operator==(LogHostList & rhs);
Modified: trafficserver/traffic/trunk/proxy/logging/LogLimits.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogLimits.h?rev=1083018&r1=1083017&r2=1083018&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogLimits.h (original)
+++ trafficserver/traffic/trunk/proxy/logging/LogLimits.h Fri Mar 18 19:04:53 2011
@@ -24,8 +24,6 @@
/***************************************************************************
This file contains constants and other limitis used within the logging
module.
-
-
***************************************************************************/
#ifndef LOG_LIMITS_H
@@ -34,11 +32,6 @@
enum
{
LOG_MAX_FORMAT_LINE = 2048, /* "format:enable:..." */
- LOG_MAX_TIMESTAMP_STRING = 128, /* "Jan 1, 1970" */
- LOG_MAX_HOSTNAME = 512, /* "foobar.com" */
- LOG_MAX_INT_STRING = 64, /* "123456789" */
- LOG_MAX_VERSION_STRING = 32, /* "1.0" */
- LOG_MAX_STATUS_STRING = 32, /* "200" */
LOG_MAX_FORMATTED_BUFFER = 20480,
LOG_MAX_FORMATTED_LINE = 10240
};
Modified: trafficserver/traffic/trunk/proxy/logging/LogObject.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogObject.cc?rev=1083018&r1=1083017&r2=1083018&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogObject.cc (original)
+++ trafficserver/traffic/trunk/proxy/logging/LogObject.cc Fri Mar 18 19:04:53 2011
@@ -938,28 +938,15 @@ LogObjectManager::_solve_filename_confli
bool conflicts = true;
if (meta_info.file_open_successful()) {
- if (meta_info.pre_panda_metafile()) {
- // assume no conflicts if pre-panda metafile and
- // write Panda style metafile with old creation_time and
- // signature of the object requesting filename
- //
- time_t creation_time = 0;
- meta_info.get_creation_time(&creation_time);
- MetaInfo new_meta_info(filename, creation_time, log_object->get_signature());
+ bool got_sig = meta_info.get_log_object_signature(&signature);
+ uint64_t obj_sig = log_object->get_signature();
+ if (got_sig && signature == obj_sig) {
conflicts = false;
- Warning("Assuming no format conflicts exist for %s", filename);
- Note("Added object_signature to metafile of %s", filename);
- } else {
- bool got_sig = meta_info.get_log_object_signature(&signature);
- uint64_t obj_sig = log_object->get_signature();
- if (got_sig && signature == obj_sig) {
- conflicts = false;
- }
- Debug("log", "LogObjectManager::_solve_filename_conflicts\n"
- "\tfilename = %s\n"
- "\tmeta file signature = %" PRIu64 "\n"
- "\tlog object signature = %" PRIu64 "\n" "\tconflicts = %d", filename, signature, obj_sig, conflicts);
}
+ Debug("log", "LogObjectManager::_solve_filename_conflicts\n"
+ "\tfilename = %s\n"
+ "\tmeta file signature = %" PRIu64 "\n"
+ "\tlog object signature = %" PRIu64 "\n" "\tconflicts = %d", filename, signature, obj_sig, conflicts);
}
if (conflicts) {
Modified: trafficserver/traffic/trunk/proxy/logging/LogObject.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogObject.h?rev=1083018&r1=1083017&r2=1083018&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogObject.h (original)
+++ trafficserver/traffic/trunk/proxy/logging/LogObject.h Fri Mar 18 19:04:53 2011
@@ -73,17 +73,18 @@ private:
LogBuffer *_flush_list;
LogBuffer **_flush_list_last;
LogBuffer *_delay_delete_array[DELAY_DELETE_SIZE];
-
int _head; // index of next buffer in deleted list
public:
- LogBufferManager():_flush_list(0), _head(0)
+ LogBufferManager()
+ : _flush_list(0), _head(0)
{
_flush_list_last = &_flush_list;
for (int i = 0; i < DELAY_DELETE_SIZE; i++)
_delay_delete_array[i] = 0;
ink_mutex_init(&_flush_array_mutex, "_flush_array_mutex");
- };
+ }
+
~LogBufferManager();
void add_to_flush_queue(LogBuffer * buffer)
@@ -94,7 +95,7 @@ public:
_flush_list_last = &buffer->next_flush;
ink_mutex_release(&_flush_array_mutex);
}
- };
+ }
LogBuffer *get_flush_queue(void)
{
@@ -105,7 +106,7 @@ public:
_flush_list_last = &_flush_list;
ink_mutex_release(&_flush_array_mutex);
return list;
- };
+ }
size_t flush_buffers(LogBufferSink * sink, size_t * to_disk, size_t * to_net, size_t * to_pipe);
};
@@ -114,7 +115,6 @@ public:
class LogObject
{
public:
-
enum LogObjectFlags
{
BINARY = 1,
@@ -127,17 +127,19 @@ public:
// it should not be destroyed during a reconfiguration
// WRITES_TO_PIPE: object writes to a named pipe rather than to a file
- LogObject(LogFormat * format, const char *log_dir, const char *basename,
- LogFileFormat file_format, const char *header,
- int rolling_enabled, int rolling_interval_sec = 0, int rolling_offset_hr = 0, int rolling_size_mb = 0);
+ LogObject(LogFormat * format, const char *log_dir, const char *basename,
+ LogFileFormat file_format, const char *header,
+ int rolling_enabled, int rolling_interval_sec = 0, int rolling_offset_hr = 0, int rolling_size_mb = 0);
private:
- LogObject(LogObject &);
+ LogObject(LogObject &);
+
public:
- virtual ~ LogObject();
+ virtual ~LogObject();
void add_filter(LogFilter * filter, bool copy = true);
void set_filter_list(const LogFilterList & list, bool copy = true);
void add_loghost(LogHost * host, bool copy = true);
+
void set_remote_flag()
{
m_flags |= REMOTE_DATA;
@@ -145,97 +147,122 @@ public:
int log(LogAccess * lad, char *text_entry = NULL);
int roll_files_if_needed(long time_now = 0);
+
int roll_files(long time_now = 0) {
return _roll_files(m_last_roll_time, time_now ? time_now : LogUtils::timestamp());
}
+
void add_to_flush_queue(LogBuffer * buffer)
{
m_buffer_manager.add_to_flush_queue(buffer);
- };
+ }
+
size_t flush_buffers(size_t * to_disk, size_t * to_net, size_t * to_pipe)
{
return (m_logFile) ? m_buffer_manager.flush_buffers(m_logFile, to_disk, to_net, to_pipe) :
m_buffer_manager.flush_buffers(&m_host_list, to_disk, to_net, to_pipe);
- };
+ }
+
void check_buffer_expiration(long time_now);
void display(FILE * fd = stdout);
void displayAsXML(FILE * fd = stdout, bool extended = false);
static uint64_t compute_signature(LogFormat * format, char *filename, unsigned int flags);
+
char *get_original_filename() const
{
return m_filename;
- };
+ }
+
char *get_full_filename() const
{
return (m_alt_filename ? m_alt_filename : m_filename);
- };
+ }
+
char *get_base_filename() const
{
return m_basename;
- };
+ }
+
off_t get_file_size_bytes();
+
uint64_t get_signature() const
{
return m_signature;
- };
+ }
+
int get_rolling_interval() const
{
return m_rolling_interval_sec;
- };
+ }
+
void set_log_file_header(const char *header)
{
m_logFile->change_header(header);
- };
+ }
+
void set_rolling_enabled(int rolling_enabled)
{
_setup_rolling(rolling_enabled, m_rolling_interval_sec, m_rolling_offset_hr, m_rolling_size_mb);
- };
+ }
+
void set_rolling_interval_sec(int rolling_interval_sec)
{
_setup_rolling(m_rolling_enabled, rolling_interval_sec, m_rolling_offset_hr, m_rolling_size_mb);
- };
+ }
+
void set_rolling_offset_hr(int rolling_offset_hr)
{
_setup_rolling(m_rolling_enabled, m_rolling_interval_sec, rolling_offset_hr, m_rolling_size_mb);
- };
+ }
+
void set_rolling_size_mb(int rolling_size_mb)
{
m_rolling_size_mb = rolling_size_mb;
- };
+ }
+
bool is_collation_client()
{
return (m_logFile ? false : true);
- };
+ }
+
bool receives_remote_data()
{
return m_flags & REMOTE_DATA ? true : false;
- };
+ }
+
bool writes_to_pipe()
{
return m_flags & WRITES_TO_PIPE ? true : false;
- };
+ }
+
bool writes_to_disk()
{
return (m_logFile && !(m_flags & WRITES_TO_PIPE) ? true : false);
- };
+ }
+
unsigned int get_flags() const
{
return m_flags;
- };
+ }
+
void rename(char *new_name);
+
bool has_alternate_name()
{
return (m_alt_filename ? true : false);
- };
+ }
+
const char *get_format_string()
{
return (m_format ? m_format->format_string() : "<none>");
- };
+ }
+
void force_new_buffer()
{
_checkout_write(NULL, 0);
- };
+ }
+
bool operator==(LogObject & rhs);
int do_filesystem_checks();
@@ -308,18 +335,18 @@ private:
/*-------------------------------------------------------------------------
RefCounter
-------------------------------------------------------------------------*/
-
class RefCounter
{
public:
- RefCounter(int *count):m_count(count)
+ RefCounter(int *count)
+ : m_count(count)
{
ink_atomic_increment(m_count, 1);
- };
+ }
~RefCounter() {
ink_atomic_increment(m_count, -1);
- };
+ }
private:
int *m_count;
@@ -375,14 +402,14 @@ private:
int _roll_files(long time_now, bool roll_only_if_needed);
public:
- LogObjectManager():_numObjects(0),
- _maxObjects(LOG_OBJECT_ARRAY_DELTA), _numAPIobjects(0), _maxAPIobjects(LOG_OBJECT_ARRAY_DELTA)
+ LogObjectManager()
+ : _numObjects(0), _maxObjects(LOG_OBJECT_ARRAY_DELTA), _numAPIobjects(0), _maxAPIobjects(LOG_OBJECT_ARRAY_DELTA)
{
_objects = new LogObject *[_maxObjects];
_APIobjects = new LogObject *[_maxAPIobjects];
_APImutex = NEW(new ink_mutex);
ink_mutex_init(_APImutex, "_APImutex");
- };
+ }
~LogObjectManager() {
for (unsigned int i = 0; i < _maxObjects; i++) {
@@ -404,10 +431,11 @@ public:
int manage_object(LogObject * logObject, int maxConflicts = 99) {
return _manage_object(logObject, false, maxConflicts);
- };
+ }
+
int manage_api_object(LogObject * logObject, int maxConflicts = 99) {
return _manage_object(logObject, true, maxConflicts);
- };
+ }
// return success
bool unmanage_api_object(LogObject * logObject);
@@ -417,13 +445,16 @@ public:
size_t get_num_objects()
{
return _numObjects;
- };
+ }
+
int roll_files(long time_now = 0) {
return _roll_files(time_now, false);
}
+
int roll_files_if_needed(long time_now = 0) {
return _roll_files(time_now, true);
- };
+ }
+
int log(LogAccess * lad);
void display(FILE * str = stdout);
void add_filter_to_all(LogFilter * filter);
@@ -431,15 +462,15 @@ public:
size_t flush_buffers(size_t * to_disk, size_t * to_net = 0, size_t * to_pipe = 0);
void open_local_pipes();
void transfer_objects(LogObjectManager & mgr);
- bool has_api_objects()
- {
+
+ bool has_api_objects() const {
return (_numAPIobjects > 0);
- };
+ }
+
size_t get_num_collation_clients();
};
-
inline int
LogObjectManager::log(LogAccess * lad)
{
Modified: trafficserver/traffic/trunk/proxy/logging/LogSock.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogSock.cc?rev=1083018&r1=1083017&r2=1083018&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogSock.cc (original)
+++ trafficserver/traffic/trunk/proxy/logging/LogSock.cc Fri Mar 18 19:04:53 2011
@@ -96,7 +96,7 @@ LogSock::listen(int accept_port)
{
struct sockaddr_in bind_addr;
int size = sizeof(struct sockaddr_in);
- char this_host[LOG_MAX_HOSTNAME];
+ char this_host[MAXDNAME];
int ret;
SOCKET accept_sd;
@@ -174,7 +174,7 @@ LogSock::listen(int accept_port)
// initialize the first entry of the table for accepting incoming
// connection requests.
//
- if (gethostname(&this_host[0], LOG_MAX_HOSTNAME) != 0) {
+ if (gethostname(&this_host[0], MAXDNAME) != 0) {
snprintf(this_host, sizeof(this_host), "unknown-host");
}
init_cid(0, this_host, accept_port, accept_sd, LogSock::LS_STATE_INCOMING);
Modified: trafficserver/traffic/trunk/proxy/logging/LogSock.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogSock.h?rev=1083018&r1=1083017&r2=1083018&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogSock.h (original)
+++ trafficserver/traffic/trunk/proxy/logging/LogSock.h Fri Mar 18 19:04:53 2011
@@ -27,7 +27,6 @@
#define LOG_SOCK_H
#include "libts.h"
-#include "LogLimits.h"
/*-------------------------------------------------------------------------
LogSock
@@ -69,8 +68,8 @@ public:
};
public:
- LogSock(int max_connects = 1);
- ~LogSock();
+ LogSock(int max_connects = 1);
+ ~LogSock();
bool pending_any(int *cid, int timeout_msec = 0);
bool pending_message_any(int *cid, int timeout_msec = 0);
@@ -94,10 +93,12 @@ public:
{
return ct[0].host;
}
+
int on_port()
{
return ct[0].port;
}
+
bool is_connected(int cid, bool ping = false);
void check_connections();
bool authorized_client(int cid, char *key);
Modified: trafficserver/traffic/trunk/proxy/logging/LogStandalone.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogStandalone.cc?rev=1083018&r1=1083017&r2=1083018&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogStandalone.cc (original)
+++ trafficserver/traffic/trunk/proxy/logging/LogStandalone.cc Fri Mar 18 19:04:53 2011
@@ -56,7 +56,7 @@ int http_accept_port_number = 0;
int http_accept_file_descriptor = 0;
int remote_management_flag = 0;
int auto_clear_hostdb_flag = 0;
-char proxy_name[DOMAIN_NAME_MAX + 1] = "unknown";
+char proxy_name[MAXDNAME + 1] = "unknown";
char system_root_dir[PATH_NAME_MAX + 1] = "";
char system_config_directory[PATH_NAME_MAX + 1] = "";
Modified: trafficserver/traffic/trunk/proxy/logging/LogUtils.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogUtils.h?rev=1083018&r1=1083017&r2=1083018&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogUtils.h (original)
+++ trafficserver/traffic/trunk/proxy/logging/LogUtils.h Fri Mar 18 19:04:53 2011
@@ -20,9 +20,6 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
-
-
-
#ifndef LOG_UTILS_H
#define LOG_UTILS_H
@@ -48,13 +45,8 @@ public:
LOG_ALARM_N_TYPES
};
- static long timestamp()
- {
- //struct timeval tp;
- //ink_gethrtimeofday (&tp, 0);
- //return tp.tv_sec;
- return (long) time(0);
- }
+ static long timestamp() { return (long)time(0); }
+
static int timestamp_to_str(long timestamp, char *buf, int size);
static char *timestamp_to_netscape_str(long timestamp);
static char *timestamp_to_date_str(long timestamp);
@@ -78,37 +70,4 @@ private:
LogUtils(const LogUtils &);
LogUtils & operator=(const LogUtils &);
};
-
-enum LogDeleteProgram {
- USE_DELETE,
- USE_XFREE
-};
-
-class LogMemoryDeleter
-{
-public:
- LogMemoryDeleter(char *buf, LogDeleteProgram p):m_buf(buf), m_p(p)
- {
- }
- ~LogMemoryDeleter()
- {
- if (m_buf) {
- switch (m_p) {
- case USE_DELETE:
- delete[]m_buf;
- break;
- case USE_XFREE:
- xfree(m_buf);
- break;
- default:
- ink_assert(!"invalid delete program for auto-deleter");
- }
- }
- }
-
-private:
- char *m_buf;
- LogDeleteProgram m_p;
-};
-
#endif
Modified: trafficserver/traffic/trunk/proxy/logstats.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logstats.cc?rev=1083018&r1=1083017&r2=1083018&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logstats.cc (original)
+++ trafficserver/traffic/trunk/proxy/logstats.cc Fri Mar 18 19:04:53 2011
@@ -1167,7 +1167,6 @@ update_schemes(OriginStats * stat, int s
int
parse_log_buff(LogBufferHeader * buf_header, bool summary = false)
{
- static char *str_buf = NULL;
static LogFieldList *fieldlist = NULL;
LogEntryHeader *entry;
@@ -1189,14 +1188,6 @@ parse_log_buff(LogBufferHeader * buf_hea
HTTPMethod method;
URLScheme scheme;
-
- // Initialize some "static" variables.
- if (NULL == str_buf) {
- str_buf = (char *) xmalloc(LOG_MAX_FORMATTED_LINE);
- if (NULL == str_buf)
- return 0;
- }
-
if (!fieldlist) {
fieldlist = NEW(new LogFieldList);
ink_assert(fieldlist != NULL);