std::ostringstream info, debug;
info << "Error while sending JSON-RPC message for identity '" << m_Identity << "'";
debug << info.str() << std::endl << DiagnosticInformation(ex);
- Log(LogWarning, "remote", info.str());
- Log(LogDebug, "remote", debug.str());
+ Log(LogWarning, "ApiClient", info.str());
+ Log(LogDebug, "ApiClient", debug.str());
Disconnect();
}
void ApiClient::Disconnect(void)
{
- Log(LogWarning, "remote", "API client disconnected for identity '" + m_Identity + "'");
+ Log(LogWarning, "ApiClient", "API client disconnected for identity '" + m_Identity + "'");
m_Stream->Close();
if (m_Endpoint)
String method = message->Get("method");
- Log(LogNotice, "remote", "Received '" + method + "' message from '" + m_Identity + "'");
+ Log(LogNotice, "ApiClient", "Received '" + method + "' message from '" + m_Identity + "'");
Dictionary::Ptr resultMessage = make_shared<Dictionary>();
Disconnect();
} catch (const std::exception& ex) {
- Log(LogWarning, "remote", "Error while reading JSON-RPC message for identity '" + m_Identity + "': " + DiagnosticInformation(ex));
+ Log(LogWarning, "ApiClient", "Error while reading JSON-RPC message for identity '" + m_Identity + "': " + DiagnosticInformation(ex));
}
}
configChange = true;
String path = configDir + "/" + kv.first;
- Log(LogInformation, "remote", "Updating configuration file: " + path);
+ Log(LogInformation, "ApiListener", "Updating configuration file: " + path);
std::ofstream fp(path.CStr(), std::ofstream::out | std::ostream::trunc);
fp << kv.second;
void ApiListener::SyncZoneDir(const Zone::Ptr& zone) const
{
- Log(LogInformation, "remote", "Syncing zone: " + zone->GetName());
+ Log(LogInformation, "ApiListener", "Syncing zone: " + zone->GetName());
String newDir = Application::GetZonesDir() + "/" + zone->GetName();
String oldDir = Application::GetLocalStateDir() + "/lib/icinga2/api/zones/" + zone->GetName();
Zone::Ptr zone = Zone::GetByName(kv.first);
if (!zone) {
- Log(LogWarning, "remote", "Ignoring config update for unknown zone: " + kv.first);
+ Log(LogWarning, "ApiListener", "Ignoring config update for unknown zone: " + kv.first);
continue;
}
}
if (configChange) {
- Log(LogInformation, "remote", "Restarting after configuration change.");
+ Log(LogInformation, "ApiListener", "Restarting after configuration change.");
Application::RequestRestart();
}
/* set up SSL context */
shared_ptr<X509> cert = GetX509Certificate(GetCertPath());
SetIdentity(GetCertificateCN(cert));
- Log(LogInformation, "remote", "My API identity: " + GetIdentity());
+ Log(LogInformation, "ApiListener", "My API identity: " + GetIdentity());
m_SSLContext = MakeSSLContext(GetCertPath(), GetKeyPath(), GetCaPath());
std::ostringstream s;
s << "Adding new listener: port " << service;
- Log(LogInformation, "remote", s.str());
+ Log(LogInformation, "ApiListener", s.str());
TcpSocket::Ptr server = make_shared<TcpSocket>();
server->Bind(service, AF_INET6);
info << "Cannot connect to host '" << node << "' on port '" << service << "'";
debug << info.str() << std::endl << DiagnosticInformation(ex);
Log(LogCritical, "remote", info.str());
- Log(LogDebug, "remote", debug.str());
+ Log(LogDebug, "ApiListener", debug.str());
}
}
shared_ptr<X509> cert = tlsStream->GetPeerCertificate();
String identity = GetCertificateCN(cert);
- Log(LogInformation, "remote", "New client connection for identity '" + identity + "'");
+ Log(LogInformation, "ApiListener", "New client connection for identity '" + identity + "'");
Endpoint::Ptr endpoint = Endpoint::GetByName(identity);
if (!need) {
String path = GetApiDir() + "log/" + Convert::ToString(ts);
- Log(LogNotice, "remote", "Removing old log file: " + path);
+ Log(LogNotice, "ApiListener", "Removing old log file: " + path);
(void)unlink(path.CStr());
}
}
BOOST_FOREACH(const ApiClient::Ptr& client, endpoint->GetClients())
client->SendMessage(lmessage);
- Log(LogNotice, "remote", "Setting log position for identity '" + endpoint->GetName() + "': " +
+ Log(LogNotice, "ApiListener", "Setting log position for identity '" + endpoint->GetName() + "': " +
Utility::FormatDateTime("%Y/%m/%d %H:%M:%S", ts));
}
- Log(LogNotice, "remote", "Current zone master: " + GetMaster()->GetName());
+ Log(LogNotice, "ApiListener", "Current zone master: " + GetMaster()->GetName());
std::vector<String> names;
BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjects<Endpoint>())
if (endpoint->IsConnected())
names.push_back(endpoint->GetName() + " (" + Convert::ToString(endpoint->GetClients().size()) + ")");
- Log(LogNotice, "remote", "Connected endpoints: " + Utility::NaturalJoin(names));
+ Log(LogNotice, "ApiListener", "Connected endpoints: " + Utility::NaturalJoin(names));
}
void ApiListener::RelayMessage(const MessageOrigin& origin, const DynamicObject::Ptr& secobj, const Dictionary::Ptr& message, bool log)
double ts = Utility::GetTime();
message->Set("ts", ts);
- Log(LogNotice, "remote", "Relaying '" + message->Get("method") + "' message");
+ Log(LogNotice, "ApiListener", "Relaying '" + message->Get("method") + "' message");
if (log)
m_LogQueue.Enqueue(boost::bind(&ApiListener::PersistMessage, this, message));
ObjectLock olock(endpoint);
if (!endpoint->GetSyncing()) {
- Log(LogNotice, "remote", "Sending message to '" + endpoint->GetName() + "'");
+ Log(LogNotice, "ApiListener", "Sending message to '" + endpoint->GetName() + "'");
BOOST_FOREACH(const ApiClient::Ptr& client, endpoint->GetClients())
client->SendMessage(message);
std::fstream *fp = new std::fstream(path.CStr(), std::fstream::out | std::ofstream::app);
if (!fp->good()) {
- Log(LogWarning, "cluster", "Could not open spool file: " + path);
+ Log(LogWarning, "ApiListener", "Could not open spool file: " + path);
return;
}
if (ts < peer_ts)
continue;
- Log(LogNotice, "remote", "Replaying log: " + path);
+ Log(LogNotice, "ApiListener", "Replaying log: " + path);
std::fstream *fp = new std::fstream(path.CStr(), std::fstream::in);
StdioStream::Ptr logStream = make_shared<StdioStream>(fp, true);
pmessage = JsonDeserialize(message);
} catch (const std::exception&) {
- Log(LogWarning, "remote", "Unexpected end-of-file for cluster log: " + path);
+ Log(LogWarning, "ApiListener", "Unexpected end-of-file for cluster log: " + path);
/* Log files may be incomplete or corrupted. This is perfectly OK. */
break;
logStream->Close();
}
- Log(LogNotice, "remote", "Replayed " + Convert::ToString(count) + " messages.");
+ Log(LogNotice, "ApiListener", "Replayed " + Convert::ToString(count) + " messages.");
if (last_sync) {
{