MCPcopy Create free account
hub / github.com/ceph/ceph / log_entry

Method log_entry

src/common/Graylog.cc:62–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62void Graylog::log_entry(const Entry& e)
63{
64 if (m_log_dst_valid) {
65 auto s = e.strv();
66
67 m_formatter->open_object_section("");
68 m_formatter->dump_string("version", "1.1");
69 m_formatter->dump_string("host", m_hostname);
70 m_formatter->dump_string("short_message", s);
71 m_formatter->dump_string("_app", "ceph");
72 auto t = ceph::logging::log_clock::to_timeval(e.m_stamp);
73 m_formatter->dump_float("timestamp", t.tv_sec + (t.tv_usec / 1000000.0));
74 m_formatter->dump_unsigned("_thread", (uint64_t)e.m_thread);
75 m_formatter->dump_int("_level", e.m_prio);
76 if (m_subs != NULL)
77 m_formatter->dump_string("_subsys_name", m_subs->get_name(e.m_subsys));
78 m_formatter->dump_int("_subsys_id", e.m_subsys);
79 m_formatter->dump_string("_fsid", m_fsid);
80 m_formatter->dump_string("_logger", m_logger);
81 m_formatter->close_section();
82
83 m_ostream_compressed.clear();
84 m_ostream_compressed.str("");
85
86 m_ostream.reset();
87
88 m_ostream.push(m_compressor);
89 m_ostream.push(m_ostream_compressed);
90
91 m_formatter->flush(m_ostream);
92 m_ostream << std::endl;
93
94 m_ostream.reset();
95
96 try {
97 boost::asio::ip::udp::socket socket(m_io_service);
98 socket.open(m_endpoint.protocol());
99 socket.send_to(boost::asio::buffer(m_ostream_compressed.str()), m_endpoint);
100 } catch (boost::system::system_error const& e) {
101 cerr << "Error sending graylog message: " << e.what() << std::endl;
102 }
103 }
104}
105
106void Graylog::log_log_entry(LogEntry const * const e)
107{

Callers 3

_flushMethod · 0.45
mainFunction · 0.45
TEST_FFunction · 0.45

Calls 15

to_timevalFunction · 0.85
send_toMethod · 0.80
strvMethod · 0.45
open_object_sectionMethod · 0.45
dump_stringMethod · 0.45
dump_floatMethod · 0.45
dump_unsignedMethod · 0.45
dump_intMethod · 0.45
get_nameMethod · 0.45
close_sectionMethod · 0.45
clearMethod · 0.45
strMethod · 0.45

Tested by 2

mainFunction · 0.36
TEST_FFunction · 0.36