void CheckerComponent::Stop(void)
{
- Log(LogInformation, "checker", "Checker stopped.");
+ Log(LogInformation, "CheckerComponent", "Checker stopped.");
{
boost::mutex::scoped_lock lock(m_Mutex);
if (!forced) {
if (!checkable->IsReachable(DependencyCheckExecution)) {
- Log(LogNotice, "icinga", "Skipping check for object '" + checkable->GetName() + "': Dependency failed.");
+ Log(LogNotice, "CheckerComponent", "Skipping check for object '" + checkable->GetName() + "': Dependency failed.");
check = false;
}
tie(host, service) = GetHostService(checkable);
if (host && !service && (!checkable->GetEnableActiveChecks() || !IcingaApplication::GetInstance()->GetEnableHostChecks())) {
- Log(LogNotice, "checker", "Skipping check for host '" + host->GetName() + "': active host checks are disabled");
+ Log(LogNotice, "CheckerComponent", "Skipping check for host '" + host->GetName() + "': active host checks are disabled");
check = false;
}
if (host && service && (!checkable->GetEnableActiveChecks() || !IcingaApplication::GetInstance()->GetEnableServiceChecks())) {
- Log(LogNotice, "checker", "Skipping check for service '" + service->GetName() + "': active service checks are disabled");
+ Log(LogNotice, "CheckerComponent", "Skipping check for service '" + service->GetName() + "': active service checks are disabled");
check = false;
}
TimePeriod::Ptr tp = checkable->GetCheckPeriod();
if (tp && !tp->IsInside(Utility::GetTime())) {
- Log(LogNotice, "checker", "Skipping check for object '" + checkable->GetName() + "': not in check_period");
+ Log(LogNotice, "CheckerComponent", "Skipping check for object '" + checkable->GetName() + "': not in check_period");
check = false;
}
}
checkable->SetForceNextCheck(false);
}
- Log(LogDebug, "checker", "Executing check for '" + checkable->GetName() + "'");
+ Log(LogDebug, "CheckerComponent", "Executing check for '" + checkable->GetName() + "'");
CheckerComponent::Ptr self = GetSelf();
Utility::QueueAsyncCallback(boost::bind(&CheckerComponent::ExecuteCheckHelper, self, checkable));
}
}
- Log(LogDebug, "checker", "Check finished for object '" + checkable->GetName() + "'");
+ Log(LogDebug, "CheckerComponent", "Check finished for object '" + checkable->GetName() + "'");
}
void CheckerComponent::ResultTimerHandler(void)
<< (CIB::GetActiveHostChecksStatistics(5) + CIB::GetActiveServiceChecksStatistics(5)) / 5.0;
}
- Log(LogNotice, "checker", msgbuf.str());
+ Log(LogNotice, "CheckerComponent", msgbuf.str());
}
void CheckerComponent::ObjectHandler(const DynamicObject::Ptr& object)
Host::Ptr host = Host::GetByName(attrs["host_name"]);
if (!host) {
- Log(LogWarning, "compat", "Ignoring checkresult file for host '" + attrs["host_name"] +
+ Log(LogWarning, "CheckResultReader", "Ignoring checkresult file for host '" + attrs["host_name"] +
"': Host does not exist.");
return;
Service::Ptr service = host->GetServiceByShortName(attrs["service_description"]);
if (!service) {
- Log(LogWarning, "compat", "Ignoring checkresult file for host '" + attrs["host_name"] +
+ Log(LogWarning, "CheckResultReader", "Ignoring checkresult file for host '" + attrs["host_name"] +
"', service '" + attrs["service_description"] + "': Service does not exist.");
return;
service->ProcessCheckResult(result);
- Log(LogDebug, "compat", "Processed checkresult file for host '" + attrs["host_name"] +
+ Log(LogDebug, "CheckResultReader", "Processed checkresult file for host '" + attrs["host_name"] +
"', service '" + attrs["service_description"] + "'");
{
flapping_state_str = "DISABLED";
break;
default:
- Log(LogCritical, "compat", "Unknown flapping state: " + Convert::ToString(flapping_state));
+ Log(LogCritical, "CompatLogger", "Unknown flapping state: " + Convert::ToString(flapping_state));
return;
}
if (rotate) {
String archiveFile = GetLogDir() + "/archives/icinga-" + Utility::FormatDateTime("%m-%d-%Y-%H", Utility::GetTime()) + ".log";
- Log(LogNotice, "compat", "Rotating compat log file '" + tempFile + "' -> '" + archiveFile + "'");
+ Log(LogNotice, "CompatLogger", "Rotating compat log file '" + tempFile + "' -> '" + archiveFile + "'");
(void) rename(tempFile.CStr(), archiveFile.CStr());
}
}
m_OutputFile.open(tempFile.CStr(), std::ofstream::app);
if (!m_OutputFile.good()) {
- Log(LogWarning, "icinga", "Could not open compat log file '" + tempFile + "' for writing. Log output will be lost.");
+ Log(LogWarning, "CompatLogger", "Could not open compat log file '" + tempFile + "' for writing. Log output will be lost.");
return;
}
time_t ts = mktime(&tmthen);
- Log(LogNotice, "compat", "Rescheduling rotation timer for compat log '"
+ Log(LogNotice, "CompatLogger", "Rescheduling rotation timer for compat log '"
+ GetName() + "' to '" + Utility::FormatDateTime("%Y/%m/%d %H:%M:%S %z", ts) + "'");
m_RotationTimer->Reschedule(ts);
}
String command = line;
try {
- Log(LogInformation, "compat", "Executing external command: " + command);
+ Log(LogInformation, "ExternalCommandListener", "Executing external command: " + command);
ExternalCommandProcessor::Execute(command);
} catch (const std::exception& ex) {
std::ostringstream msgbuf;
msgbuf << "External command failed: " << DiagnosticInformation(ex);
- Log(LogWarning, "compat", msgbuf.str());
+ Log(LogWarning, "ExternalCommandListener", msgbuf.str());
}
}
Checkable::Ptr parent = dep->GetParent();
if (!parent) {
- Log(LogDebug, "compat", "Missing parent for dependency '" + dep->GetName() + "'.");
+ Log(LogDebug, "StatusDataWriter", "Missing parent for dependency '" + dep->GetName() + "'.");
continue;
}
if (!child) {
continue;
- Log(LogDebug, "compat", "Missing child for dependency '" + dep->GetName() + "'.");
+ Log(LogDebug, "StatusDataWriter", "Missing child for dependency '" + dep->GetName() + "'.");
}
Host::Ptr child_host;
<< boost::errinfo_file_name(statuspathtmp));
}
- Log(LogNotice, "compat", "Writing status.dat file took " + Utility::FormatDuration(Utility::GetTime() - start));
+ Log(LogNotice, "StatusDataWriter", "Writing status.dat file took " + Utility::FormatDuration(Utility::GetTime() - start));
}
void IdoMysqlConnection::ExceptionHandler(boost::exception_ptr exp)
{
- Log(LogWarning, "db_ido_mysql", "Exception during database operation: " + DiagnosticInformation(exp));
+ Log(LogWarning, "IdoMysqlConnection", "Exception during database operation: " + DiagnosticInformation(exp));
boost::mutex::scoped_lock lock(m_ConnectionMutex);
std::ostringstream msgbuf;
msgbuf << "MySQL IDO instance id: " << static_cast<long>(m_InstanceID) << " (schema version: '" + version + "')";
- Log(LogInformation, "db_ido_mysql", msgbuf.str());
+ Log(LogInformation, "IdoMysqlConnection", msgbuf.str());
/* set session time zone to utc */
Query("SET SESSION TIME_ZONE='+00:00'");
/* deactivate all deleted configuration objects */
BOOST_FOREACH(const DbObject::Ptr& dbobj, active_dbobjs) {
if (dbobj->GetObject() == NULL) {
- Log(LogNotice, "db_ido", "Deactivate deleted object name1: '" + Convert::ToString(dbobj->GetName1() +
+ Log(LogNotice, "IdoMysqlConnection", "Deactivate deleted object name1: '" + Convert::ToString(dbobj->GetName1() +
"' name2: '" + Convert::ToString(dbobj->GetName2() + "'.")));
DeactivateObject(dbobj);
}
{
AssertOnWorkQueue();
- Log(LogDebug, "db_ido_mysql", "Query: " + query);
+ Log(LogDebug, "IdoMysqlConnection", "Query: " + query);
if (mysql_query(&m_Connection, query.CStr()) != 0)
BOOST_THROW_EXCEPTION(
if (type == DbQueryInsert && query.Table == "notifications" && query.NotificationObject) { // FIXME remove hardcoded table name
SetNotificationInsertID(query.NotificationObject, GetLastInsertID());
- Log(LogDebug, "db_ido", "saving contactnotification notification_id=" + Convert::ToString(static_cast<long>(GetLastInsertID())));
+ Log(LogDebug, "IdoMysqlConnection", "saving contactnotification notification_id=" + Convert::ToString(static_cast<long>(GetLastInsertID())));
}
}
void IdoPgsqlConnection::ExceptionHandler(boost::exception_ptr exp)
{
- Log(LogWarning, "db_ido_pgsql", "Exception during database operation: " + DiagnosticInformation(exp));
+ Log(LogWarning, "IdoPgsqlConnection", "Exception during database operation: " + DiagnosticInformation(exp));
boost::mutex::scoped_lock lock(m_ConnectionMutex);
std::ostringstream msgbuf;
msgbuf << "pgSQL IDO instance id: " << static_cast<long>(m_InstanceID) << " (schema version: '" + version + "')";
- Log(LogInformation, "db_ido_pgsql", msgbuf.str());
+ Log(LogInformation, "IdoPgsqlConnection", msgbuf.str());
/* record connection */
Query("INSERT INTO " + GetTablePrefix() + "conninfo " +
/* deactivate all deleted configuration objects */
BOOST_FOREACH(const DbObject::Ptr& dbobj, active_dbobjs) {
if (dbobj->GetObject() == NULL) {
- Log(LogNotice, "db_ido", "Deactivate deleted object name1: '" + Convert::ToString(dbobj->GetName1() +
+ Log(LogNotice, "IdoPgsqlConnection", "Deactivate deleted object name1: '" + Convert::ToString(dbobj->GetName1() +
"' name2: '" + Convert::ToString(dbobj->GetName2() + "'.")));
DeactivateObject(dbobj);
}
{
AssertOnWorkQueue();
- Log(LogDebug, "db_ido_pgsql", "Query: " + query);
+ Log(LogDebug, "IdoPgsqlConnection", "Query: " + query);
PGresult *result = PQexec(m_Connection, query.CStr());
std::ostringstream msgbuf;
msgbuf << "Sequence Value: " << row->Get("id");
- Log(LogDebug, "db_ido_pgsql", msgbuf.str());
+ Log(LogDebug, "IdoPgsqlConnection", msgbuf.str());
return DbReference(Convert::ToLong(row->Get("id")));
}
if (type == DbQueryInsert && query.Table == "notifications" && query.NotificationObject) { // FIXME remove hardcoded table name
String idField = "notification_id";
SetNotificationInsertID(query.NotificationObject, GetSequenceValue(GetTablePrefix() + query.Table, idField));
- Log(LogDebug, "db_ido", "saving contactnotification notification_id=" + Convert::ToString(static_cast<long>(GetSequenceValue(GetTablePrefix() + query.Table, idField))));
+ Log(LogDebug, "IdoPgsqlConnection", "saving contactnotification notification_id=" + Convert::ToString(static_cast<long>(GetSequenceValue(GetTablePrefix() + query.Table, idField))));
}
}
ApiListener::Ptr listener = ApiListener::GetInstance();
if (listener) {
listener->RelayMessage(MessageOrigin(), DynamicObject::Ptr(), message, true);
- Log(LogInformation, "demo", "Sent demo::HelloWorld message");
+ Log(LogInformation, "Demo", "Sent demo::HelloWorld message");
}
}
Value Demo::DemoMessageHandler(const MessageOrigin& origin, const Dictionary::Ptr&)
{
- Log(LogInformation, "demo", "Got demo message from '" + origin.FromClient->GetEndpoint()->GetName() + "'");
+ Log(LogInformation, "Demo", "Got demo message from '" + origin.FromClient->GetEndpoint()->GetName() + "'");
return Empty;
}
boost::smatch what;
bool ret = boost::regex_search(operand.GetData(), what, expr);
- //Log(LogDebug, "livestatus", "Attribute filter '" + m_Operand + " " + m_Operator + " " +
+ //Log(LogDebug, "LivestatusListener/AttributeFilter", "Attribute filter '" + m_Operand + " " + m_Operator + " " +
// static_cast<String>(value) + "' " + (ret ? "matches" : "doesn't match") + "." );
return ret;
boost::smatch what;
bool ret = boost::regex_search(operand.GetData(), what, expr);
- //Log(LogDebug, "livestatus", "Attribute filter '" + m_Operand + " " + m_Operator + " " +
+ //Log(LogDebug, "LivestatusListener/AttributeFilter", "Attribute filter '" + m_Operand + " " + m_Operator + " " +
// static_cast<String>(value) + "' " + (ret ? "matches" : "doesn't match") + "." );
return ret;
boost::thread thread(boost::bind(&LivestatusListener::ServerThreadProc, this, socket));
thread.detach();
- Log(LogInformation, "livestatus", "Created tcp socket listening on host '" + GetBindHost() + "' port '" + GetBindPort() + "'.");
+ Log(LogInformation, "LivestatusListener", "Created tcp socket listening on host '" + GetBindHost() + "' port '" + GetBindPort() + "'.");
}
else if (GetSocketType() == "unix") {
#ifndef _WIN32
boost::thread thread(boost::bind(&LivestatusListener::ServerThreadProc, this, socket));
thread.detach();
- Log(LogInformation, "livestatus", "Created unix socket in '" + GetSocketPath() + "'.");
+ Log(LogInformation, "LivestatusListener", "Created unix socket in '" + GetSocketPath() + "'.");
#else
/* no unix sockets on windows */
- Log(LogCritical, "livestatus", "Unix sockets are not supported on Windows.");
+ Log(LogCritical, "LivestatusListener", "Unix sockets are not supported on Windows.");
return;
#endif
}
for (;;) {
Socket::Ptr client = server->Accept();
- Log(LogNotice, "livestatus", "Client connected");
+ Log(LogNotice, "LivestatusListener", "Client connected");
Utility::QueueAsyncCallback(boost::bind(&LivestatusListener::ClientHandler, this, client));
}
void LogTable::FetchRows(const AddRowFunction& addRowFn)
{
- Log(LogNotice, "livestatus", "Pre-selecting log file from " + Convert::ToString(m_TimeFrom) + " until " + Convert::ToString(m_TimeUntil));
+ Log(LogNotice, "LivestatusListener/LogTable", "Pre-selecting log file from " + Convert::ToString(m_TimeFrom) + " until " + Convert::ToString(m_TimeUntil));
/* create log file index */
LogUtility::CreateLogIndex(m_CompatLogPath, m_LogFileIndex);
stream.close();
- Log(LogDebug, "livestatus", "Indexing log file: '" + path + "' with timestamp start: '" + Convert::ToString(ts_start) + "'.");
+ Log(LogDebug, "LivestatusListener/LogUtility", "Indexing log file: '" + path + "' with timestamp start: '" + Convert::ToString(ts_start) + "'.");
index[ts_start] = path;
}
/* no attributes available - invalid log line */
if (!log_entry_attrs) {
- Log(LogDebug, "livestatus", "Skipping invalid log line: '" + line + "'.");
+ Log(LogDebug, "LivestatusListener/LogUtility", "Skipping invalid log line: '" + line + "'.");
continue;
}
*/
unsigned long time = atoi(text.SubStr(1, 11).CStr());
- Log(LogDebug, "livestatus", "Processing log line: '" + text + "'.");
+ Log(LogDebug, "LivestatusListener/LogUtility", "Processing log line: '" + text + "'.");
bag->Set("time", time);
size_t colon = text.FindFirstOf(':');
BOOST_FOREACH(const String& line, lines) {
msg += line + "\n";
}
- Log(LogDebug, "livestatus", msg);
+ Log(LogDebug, "LivestatusListener/Query", msg);
m_CompatLogPath = compat_log_path;
if (header == "Or" || header == "StatsOr") {
filter = make_shared<OrFilter>();
- Log(LogDebug, "livestatus", "Add OR filter for " + params + " column(s). " + Convert::ToString(deq.size()) + " filters available.");
+ Log(LogDebug, "LivestatusListener/Query", "Add OR filter for " + params + " column(s). " + Convert::ToString(deq.size()) + " filters available.");
} else {
filter = make_shared<AndFilter>();
- Log(LogDebug, "livestatus", "Add AND filter for " + params + " column(s). " + Convert::ToString(deq.size()) + " filters available.");
+ Log(LogDebug, "LivestatusListener/Query", "Add AND filter for " + params + " column(s). " + Convert::ToString(deq.size()) + " filters available.");
}
if (num > deq.size()) {
while (num > 0 && num--) {
filter->AddSubFilter(deq.back());
- Log(LogDebug, "livestatus", "Add " + Convert::ToString(num) + " filter.");
+ Log(LogDebug, "LivestatusListener/Query", "Add " + Convert::ToString(num) + " filter.");
deq.pop_back();
if (&deq == &stats)
aggregators.pop_back();
}
}
- Log(LogDebug, "livestatus", "Parsed filter with attr: '" + attr + "' op: '" + op + "' val: '" + val + "'.");
+ Log(LogDebug, "LivestatusListener/Query", "Parsed filter with attr: '" + attr + "' op: '" + op + "' val: '" + val + "'.");
return filter;
}
void Query::ExecuteGetHelper(const Stream::Ptr& stream)
{
- Log(LogInformation, "livestatus", "Table: " + m_Table);
+ Log(LogInformation, "LivestatusListener/Query", "Table: " + m_Table);
Table::Ptr table = Table::GetByName(m_Table, m_CompatLogPath, m_LogTimeFrom, m_LogTimeUntil);
l_ExternalCommands++;
}
- Log(LogInformation, "livestatus", "Executing command: " + m_Command);
+ Log(LogInformation, "LivestatusListener/Query", "Executing command: " + m_Command);
ExternalCommandProcessor::Execute(m_Command);
SendResponse(stream, LivestatusErrorOK, "");
}
void Query::ExecuteErrorHelper(const Stream::Ptr& stream)
{
- Log(LogDebug, "livestatus", "ERROR: Code: '" + Convert::ToString(m_ErrorCode) + "' Message: '" + m_ErrorMessage + "'.");
+ Log(LogDebug, "LivestatusListener/Query", "ERROR: Code: '" + Convert::ToString(m_ErrorCode) + "' Message: '" + m_ErrorMessage + "'.");
SendResponse(stream, m_ErrorCode, m_ErrorMessage);
}
std::ostringstream info;
info << "Exception thrown while writing to the livestatus socket: " << std::endl
<< DiagnosticInformation(ex);
- Log(LogCritical, "livestatus", info.str());
+ Log(LogCritical, "LivestatusListener/Query", info.str());
}
}
}
std::ostringstream info;
info << "Exception thrown while writing to the livestatus socket: " << std::endl
<< DiagnosticInformation(ex);
- Log(LogCritical, "livestatus", info.str());
+ Log(LogCritical, "LivestatusListener/Query", info.str());
}
}
bool Query::Execute(const Stream::Ptr& stream)
{
try {
- Log(LogInformation, "livestatus", "Executing livestatus query: " + m_Verb);
+ Log(LogInformation, "LivestatusListener/Query", "Executing livestatus query: " + m_Verb);
if (m_Verb == "GET")
ExecuteGetHelper(stream);
state_hist_service_states->Add(state_hist_bag);
- Log(LogDebug, "livestatus", "statehist: Adding new object '" + checkable->GetName() + "' to services cache.");
+ Log(LogDebug, "LivestatusListener/StateHistTable", "statehist: Adding new object '" + checkable->GetName() + "' to services cache.");
} else {
state_hist_service_states = m_CheckablesCache[checkable];
state_hist_bag = state_hist_service_states->Get(state_hist_service_states->GetLength()-1); /* fetch latest state from history */
state_hist_service_states->Add(state_hist_bag_new);
- Log(LogDebug, "livestatus", "statehist: State change detected for object '" +
+ Log(LogDebug, "LivestatusListener/StateHistTable", "statehist: State change detected for object '" +
checkable->GetName() + "' in '" + log_line + "'.");
}
break;
void StateHistTable::FetchRows(const AddRowFunction& addRowFn)
{
- Log(LogNotice, "livestatus", "Pre-selecting log file from " + Convert::ToString(m_TimeFrom) + " until " + Convert::ToString(m_TimeUntil));
+ Log(LogNotice, "LivestatusListener/StateHistTable", "Pre-selecting log file from " + Convert::ToString(m_TimeFrom) + " until " + Convert::ToString(m_TimeUntil));
/* create log file index */
LogUtility::CreateLogIndex(m_CompatLogPath, m_LogFileIndex);
}
try {
- Log(LogInformation, "notification", "Sending reminder notification for object '" + checkable->GetName() + "'");
+ Log(LogInformation, "NotificationComponent", "Sending reminder notification for object '" + checkable->GetName() + "'");
notification->BeginExecuteNotification(NotificationProblem, checkable->GetLastCheckResult(), false);
} catch (const std::exception& ex) {
std::ostringstream msgbuf;
<< GetName() << "': " << DiagnosticInformation(ex);
String message = msgbuf.str();
- Log(LogWarning, "icinga", message);
+ Log(LogWarning, "NotificationComponent", message);
}
}
}
try {
if (m_Stream) {
m_Stream->Write("\n", 1);
- Log(LogNotice, "perfdata", "GraphiteWriter already connected on socket on host '" + GetHost() + "' port '" + GetPort() + "'.");
+ Log(LogNotice, "GraphiteWriter", "GraphiteWriter already connected on socket on host '" + GetHost() + "' port '" + GetPort() + "'.");
return;
}
} catch (const std::exception& ex) {
- Log(LogWarning, "perfdata", "GraphiteWriter socket on host '" + GetHost() + "' port '" + GetPort() + "' gone. Attempting to reconnect.");
+ Log(LogWarning, "GraphiteWriter", "GraphiteWriter socket on host '" + GetHost() + "' port '" + GetPort() + "' gone. Attempting to reconnect.");
}
TcpSocket::Ptr socket = make_shared<TcpSocket>();
- Log(LogNotice, "perfdata", "GraphiteWriter: Reconnect to tcp socket on host '" + GetHost() + "' port '" + GetPort() + "'.");
+ Log(LogNotice, "GraphiteWriter", "GraphiteWriter: Reconnect to tcp socket on host '" + GetHost() + "' port '" + GetPort() + "'.");
socket->Connect(GetHost(), GetPort());
m_Stream = make_shared<NetworkStream>(socket);
msgbuf << prefix << "." << name << " " << value << " " << static_cast<long>(Utility::GetTime()) << "\n";
String metric = msgbuf.str();
- Log(LogDebug, "perfdata", "GraphiteWriter: Add to metric list:'" + metric + "'.");
+ Log(LogDebug, "GraphiteWriter", "GraphiteWriter: Add to metric list:'" + metric + "'.");
ObjectLock olock(this);
msgbuf << "Exception thrown while writing to the Graphite socket: " << std::endl
<< DiagnosticInformation(ex);
- Log(LogCritical, "perfdata", msgbuf.str());
+ Log(LogCritical, "GraphiteWriter", msgbuf.str());
m_Stream.reset();
}
output.open(temp_path.CStr());
if (!output.good())
- Log(LogWarning, "icinga", "Could not open perfdata file '" + temp_path + "' for writing. Perfdata will be lost.");
+ Log(LogWarning, "PerfdataWriter", "Could not open perfdata file '" + temp_path + "' for writing. Perfdata will be lost.");
}
void PerfdataWriter::RotationTimerHandler(void)