an Telegraf Agent over TCP, UDP or a UNIX Socket. Telegraf can then
send the statistics to databases like InfluxDB, ElasticSearch, Graphite
and many more.
+
+* The graylog fields naming the originator of a log event have
+ changed: the string-form name is now included (e.g., ``"name":
+ "mgr.foo"``), and the rank-form name is now in a nested section
+ (e.g., ``"rank": {"type": "mgr", "num": 43243}``).
+
+* If the cluster log is directed at syslog, the entries are now
+ prefixed by both the string-form name and the rank-form name (e.g.,
+ ``mgr.x mgr.12345 ...`` instead of just ``mgr.12345 ...``).
m_formatter->dump_float("timestamp", e->stamp.sec() + (e->stamp.usec() / 1000000.0));
m_formatter->dump_string("_app", "ceph");
- m_formatter_section->open_object_section("");
- e->who.addr.dump(m_formatter_section.get());
- e->who.name.dump(m_formatter_section.get());
+ m_formatter->dump_string("name", e->name.to_str());
+
+ m_formatter_section->open_object_section("rank");
+ e->rank.dump(m_formatter_section.get());
+ m_formatter_section->close_section();
+
+ m_formatter_section->open_object_section("addrs");
+ e->addrs.dump(m_formatter_section.get());
m_formatter_section->close_section();
m_ostream_section.clear();
LogEntry e;
e.stamp = ceph_clock_now();
// seq and who should be set for syslog/graylog/log_to_mon
- e.who = parent->get_myinst();
+ e.addrs = parent->get_myaddrs();
e.name = parent->get_myname();
+ e.rank = parent->get_myrank();
e.prio = prio;
e.msg = s;
e.channel = get_log_channel();
return ++last_log;
}
-const entity_inst_t& LogClient::get_myinst()
+entity_addrvec_t LogClient::get_myaddrs()
{
- return messenger->get_myinst();
+ return entity_addrvec_t(messenger->get_myaddr());
+}
+
+entity_name_t LogClient::get_myrank()
+{
+ return messenger->get_myname();
}
const EntityName& LogClient::get_myname()
}
uint64_t get_next_seq();
- const entity_inst_t& get_myinst();
+ entity_addrvec_t get_myaddrs();
const EntityName& get_myname();
+ entity_name_t get_myrank();
version_t queue(LogEntry &entry);
private:
void LogEntryKey::dump(Formatter *f) const
{
- f->dump_stream("who") << who;
+ f->dump_stream("rank") << rank;
f->dump_stream("stamp") << stamp;
f->dump_unsigned("seq", seq);
}
void LogEntryKey::generate_test_instances(list<LogEntryKey*>& o)
{
o.push_back(new LogEntryKey);
- o.push_back(new LogEntryKey(entity_inst_t(), utime_t(1,2), 34));
+ o.push_back(new LogEntryKey(entity_name_t::CLIENT(1234), utime_t(1,2), 34));
}
clog_type LogEntry::str_to_level(std::string const &str)
int l = clog_type_to_syslog_level(prio);
if (l <= min) {
int f = string_to_syslog_facility(facility);
- syslog(l | f, "%s %llu : %s",
- stringify(who).c_str(),
+ syslog(l | f, "%s %s %llu : %s",
+ name.to_cstr(),
+ stringify(rank).c_str(),
(long long unsigned)seq,
msg.c_str());
}
void LogEntry::encode(bufferlist& bl, uint64_t features) const
{
- ENCODE_START(4, 2, bl);
+ if (!HAVE_FEATURE(features, SERVER_NAUTILUS)) {
+ ENCODE_START(4, 2, bl);
+ __u16 t = prio;
+ entity_inst_t who;
+ who.name = rank;
+ who.addr = addrs.legacy_addr();
+ encode(who, bl, features);
+ encode(stamp, bl);
+ encode(seq, bl);
+ encode(t, bl);
+ encode(msg, bl);
+ encode(channel, bl);
+ encode(name, bl);
+ ENCODE_FINISH(bl);
+ return;
+ }
+ ENCODE_START(5, 5, bl);
__u16 t = prio;
- encode(who, bl, features);
+ encode(name, bl);
+ encode(rank, bl);
+ encode(addrs, bl, features);
encode(stamp, bl);
encode(seq, bl);
encode(t, bl);
encode(msg, bl);
encode(channel, bl);
- encode(name, bl);
ENCODE_FINISH(bl);
}
void LogEntry::decode(bufferlist::const_iterator& bl)
{
- DECODE_START_LEGACY_COMPAT_LEN(4, 2, 2, bl);
- __u16 t;
- decode(who, bl);
- decode(stamp, bl);
- decode(seq, bl);
- decode(t, bl);
- prio = (clog_type)t;
- decode(msg, bl);
- if (struct_v >= 3) {
- decode(channel, bl);
+ DECODE_START_LEGACY_COMPAT_LEN(5, 2, 2, bl);
+ if (struct_v < 5) {
+ __u16 t;
+ entity_inst_t who;
+ decode(who, bl);
+ rank = who.name;
+ addrs.v.clear();
+ addrs.v.push_back(who.addr);
+ decode(stamp, bl);
+ decode(seq, bl);
+ decode(t, bl);
+ prio = (clog_type)t;
+ decode(msg, bl);
+ if (struct_v >= 3) {
+ decode(channel, bl);
+ } else {
+ // prior to having logging channels we only had a cluster log.
+ // Ensure we keep that appearance when the other party has no
+ // clue of what a 'channel' is.
+ channel = CLOG_CHANNEL_CLUSTER;
+ }
+ if (struct_v >= 4) {
+ decode(name, bl);
+ }
} else {
- // prior to having logging channels we only had a cluster log.
- // Ensure we keep that appearance when the other party has no
- // clue of what a 'channel' is.
- channel = CLOG_CHANNEL_CLUSTER;
- }
- if (struct_v >= 4) {
+ __u16 t;
decode(name, bl);
+ decode(rank, bl);
+ decode(addrs, bl);
+ decode(stamp, bl);
+ decode(seq, bl);
+ decode(t, bl);
+ prio = (clog_type)t;
+ decode(msg, bl);
+ decode(channel, bl);
}
DECODE_FINISH(bl);
}
void LogEntry::dump(Formatter *f) const
{
- f->dump_stream("who") << who;
f->dump_stream("name") << name;
+ f->dump_stream("rank") << rank;
+ f->dump_object("addrs", addrs);
f->dump_stream("stamp") << stamp;
f->dump_unsigned("seq", seq);
f->dump_string("channel", channel);
#define CEPH_LOGENTRY_H
#include "include/utime.h"
-#include "msg/msg_types.h" // for entity_inst_t
+#include "msg/msg_types.h"
#include "common/entity_name.h"
namespace ceph {
uint64_t _hash = 0;
void _calc_hash() {
- hash<entity_inst_t> h;
- _hash = seq + h(who);
+ hash<entity_name_t> h;
+ _hash = seq + h(rank);
}
- entity_inst_t who;
+ entity_name_t rank;
utime_t stamp;
uint64_t seq = 0;
public:
LogEntryKey() {}
- LogEntryKey(const entity_inst_t& w, utime_t t, uint64_t s)
- : who(w), stamp(t), seq(s) {
+ LogEntryKey(const entity_name_t& w, utime_t t, uint64_t s)
+ : rank(w), stamp(t), seq(s) {
_calc_hash();
}
static void generate_test_instances(list<LogEntryKey*>& o);
friend bool operator==(const LogEntryKey& l, const LogEntryKey& r) {
- return l.who == r.who && l.stamp == r.stamp && l.seq == r.seq;
+ return l.rank == r.rank && l.stamp == r.stamp && l.seq == r.seq;
}
};
} // namespace std
struct LogEntry {
- entity_inst_t who;
EntityName name;
+ entity_name_t rank;
+ entity_addrvec_t addrs;
utime_t stamp;
uint64_t seq;
clog_type prio;
LogEntry() : seq(0), prio(CLOG_DEBUG) {}
- LogEntryKey key() const { return LogEntryKey(who, stamp, seq); }
+ LogEntryKey key() const { return LogEntryKey(rank, stamp, seq); }
void log_to_syslog(string level, string facility);
inline ostream& operator<<(ostream& out, const LogEntry& e)
{
- return out << e.stamp << " " << e.name << " " << e.who
- << " " << e.seq << " : "
+ return out << e.stamp << " " << e.name << " (" << e.rank
+ << " " << e.addrs << ") " << e.seq << " : "
<< e.channel << " " << e.prio << " " << e.msg;
}
ostringstream ss;
ss << e.stamp << " " << e.name << " " << e.prio << " " << e.msg;
string line = ss.str();
- string who = stringify(e.who);
+ string who = stringify(e.rank) + " " + stringify(e.addrs);
string name = stringify(e.name);
string level = stringify(e.prio);
struct timespec stamp;
dout(10) << "create_initial -- creating initial map" << dendl;
LogEntry e;
e.name = g_conf->name;
+ e.rank = entity_name_t::MON(mon->rank);
+ e.addrs.v.push_back(mon->messenger->get_myaddr());
e.stamp = ceph_clock_now();
e.prio = CLOG_INFO;
std::stringstream ss;
vector<string> logtext;
cmd_getval(g_ceph_context, cmdmap, "logtext", logtext);
LogEntry le;
- le.who = m->get_orig_source_inst();
+ le.rank = m->get_orig_source();
+ le.addrs.v.push_back(m->get_orig_source_addr());
le.name = session->entity_name;
le.stamp = m->get_recv_stamp();
le.seq = 0;
"jest": {
"preset": "jest-preset-angular",
"setupTestFrameworkScriptFile": "<rootDir>/src/setupJest.ts",
- "transformIgnorePatterns": ["node_modules/(?!@ngrx|ngx-bootstrap|@progress)"],
+ "transformIgnorePatterns": [
+ "node_modules/(?!@ngrx|ngx-bootstrap|@progress)"
+ ],
"transform": {
"^.+\\.(ts|html)$": "<rootDir>/node_modules/jest-preset-angular/preprocessor.js",
"^.+\\.js$": "babel-jest"
},
- "setupFiles": ["jest-canvas-mock"],
- "coverageReporters" : [
+ "setupFiles": [
+ "jest-canvas-mock"
+ ],
+ "coverageReporters": [
"text",
"cobertura"
]
int seq = 0;
for (; num_entries > 0; --num_entries) {
LogEntry e;
- e.who = messenger->get_myinst();
+ e.rank = messenger->get_myname();
+ e.addrs.v.push_back(messenger->get_myaddr());
e.stamp = now;
e.seq = seq++;
e.prio = CLOG_DEBUG;