#include <iostream>
#include <sstream>
-#include <memory>
#include <arpa/inet.h>
-#include <boost/asio.hpp>
-#include <boost/iostreams/filtering_stream.hpp>
-#include <boost/iostreams/filter/zlib.hpp>
#include <boost/lexical_cast.hpp>
#include "common/Formatter.h"
+#include "common/LogEntry.h"
+#include "log/Entry.h"
+#include "log/SubsystemMap.h"
#include "include/uuid.h"
namespace ceph {
m_hostname = host;
}
-void Graylog::set_fsid(uuid_d fsid)
+void Graylog::set_fsid(const uuid_d& fsid)
{
std::vector<char> buf(40);
fsid.print(&buf[0]);
#include <memory>
-#include <boost/thread/mutex.hpp>
#include <boost/asio.hpp>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/filter/zlib.hpp>
-#include "log/Entry.h"
-#include "log/SubsystemMap.h"
-#include "common/LogEntry.h"
#include "include/memory.h"
+struct uuid_d;
+class LogEntry;
+
namespace ceph {
+
+class Formatter;
+
namespace log {
+struct Entry;
+class SubsystemMap;
+
// Graylog logging backend: Convert log datastructures (LogEntry, Entry) to
// GELF (http://www.graylog2.org/resources/gelf/specification) and send it
// to a GELF UDP receiver
virtual ~Graylog();
void set_hostname(const std::string& host);
- void set_fsid(uuid_d fsid);
+ void set_fsid(const uuid_d& fsid);
void set_destination(const std::string& host, int port);
#include "include/types.h"
#include "include/str_map.h"
+#include "include/uuid.h"
#include "msg/Messenger.h"
#include "msg/Message.h"
#include <sys/mount.h>
#endif // DARWIN
+#include "common/Graylog.h"
+// wipe the assert() introduced by boost headers included by Graylog.h
+#include "include/assert.h"
#include "common/LogClient.h"
#include "common/config.h"
#include "common/LogEntry.h"
#include "common/Mutex.h"
-#include "include/uuid.h"
-#include "common/Graylog.h"
#include <iosfwd>
#include <sstream>
class Messenger;
class MonMap;
class Message;
+struct uuid_d;
struct Connection;
class LogChannel;
+namespace ceph {
+namespace log {
+ class Graylog;
+}
+}
+
int parse_log_client_options(CephContext *cct,
map<string,string> &log_to_monitors,
map<string,string> &log_to_syslog,
std::string syslog_facility;
bool log_to_syslog;
bool log_to_monitors;
- ceph::log::Graylog::Ref graylog;
+ shared_ptr<ceph::log::Graylog> graylog;
friend class LogClientTemp;
#include "common/errno.h"
#include "common/lockdep.h"
#include "common/Formatter.h"
+#include "common/Graylog.h"
#include "log/Log.h"
#include "auth/Crypto.h"
#include "include/str_list.h"
#include "common/errno.h"
#include "common/safe_io.h"
#include "common/Clock.h"
+#include "common/Graylog.h"
#include "common/valgrind.h"
#include "common/Formatter.h"
#include "include/assert.h"
#include "common/Thread.h"
-#include <assert.h>
#include <pthread.h>
-#include <boost/asio.hpp>
#include "Entry.h"
#include "EntryQueue.h"
#include "SubsystemMap.h"
-#include "common/Graylog.h"
namespace ceph {
namespace log {
+class Graylog;
+
class Log : private Thread
{
Log **m_indirect_this;
int m_stderr_log, m_stderr_crash;
int m_graylog_log, m_graylog_crash;
- Graylog::Ref m_graylog;
+ shared_ptr<Graylog> m_graylog;
bool m_stop;
void start_graylog();
void stop_graylog();
- Graylog::Ref graylog() { return m_graylog; }
+ shared_ptr<Graylog> graylog() { return m_graylog; }
Entry *create_entry(int level, int subsys);
Entry *create_entry(int level, int subsys, size_t* expected_size);
#include "messages/MLogAck.h"
#include "common/Timer.h"
+#include "common/Graylog.h"
#include "osd/osd_types.h"
#include "common/errno.h"
return ret;
}
+ceph::log::Graylog::Ref LogMonitor::log_channel_info::get_graylog(
+ const string &channel)
+{
+ generic_dout(25) << __func__ << " for channel '"
+ << channel << "'" << dendl;
+
+ if (graylogs.count(channel) == 0) {
+ ceph::log::Graylog::Ref graylog = ceph::log::Graylog::Ref(new ceph::log::Graylog("mon"));
+
+ graylog->set_fsid(g_conf->fsid);
+ graylog->set_hostname(g_conf->host);
+ graylog->set_destination(get_str_map_key(log_to_graylog_host, channel,
+ &CLOG_CONFIG_DEFAULT_KEY),
+ atoi(get_str_map_key(log_to_graylog_port, channel,
+ &CLOG_CONFIG_DEFAULT_KEY).c_str()));
+
+ graylogs[channel] = graylog;
+ generic_dout(20) << __func__ << " for channel '"
+ << channel << "' to graylog host '"
+ << log_to_graylog_host[channel] << ":"
+ << log_to_graylog_port[channel]
+ << "'" << dendl;
+ }
+ return graylogs[channel];
+}
+
void LogMonitor::handle_conf_change(const struct md_config_t *conf,
const std::set<std::string> &changed)
{
#include "common/LogEntry.h"
#include "messages/MLog.h"
-#include "common/Graylog.h"
class MMonCommand;
static const string LOG_META_CHANNEL = "$channel";
+namespace ceph {
+namespace log {
+ class Graylog;
+}
+}
+
class LogMonitor : public PaxosService,
public md_config_obs_t {
private:
map<string,string> log_to_graylog_host;
map<string,string> log_to_graylog_port;
- map<string, ceph::log::Graylog::Ref> graylogs;
+ map<string, shared_ptr<ceph::log::Graylog>> graylogs;
uuid_d fsid;
string host;
&CLOG_CONFIG_DEFAULT_KEY) == "true");
}
- ceph::log::Graylog::Ref get_graylog(const string &channel) {
- generic_dout(25) << __func__ << " for channel '"
- << channel << "'" << dendl;
-
- if (graylogs.count(channel) == 0) {
- ceph::log::Graylog::Ref graylog = ceph::log::Graylog::Ref(new ceph::log::Graylog("mon"));
-
- graylog->set_fsid(g_conf->fsid);
- graylog->set_hostname(g_conf->host);
- graylog->set_destination(get_str_map_key(log_to_graylog_host, channel,
- &CLOG_CONFIG_DEFAULT_KEY),
- atoi(get_str_map_key(log_to_graylog_port, channel,
- &CLOG_CONFIG_DEFAULT_KEY).c_str()));
-
- graylogs[channel] = graylog;
- generic_dout(20) << __func__ << " for channel '"
- << channel << "' to graylog host '"
- << log_to_graylog_host[channel] << ":"
- << log_to_graylog_port[channel]
- << "'" << dendl;
- }
- return graylogs[channel];
- }
+ shared_ptr<ceph::log::Graylog> get_graylog(const string &channel);
} channels;
void update_log_channels();