e.stamp = ceph_clock_now();
// seq and who should be set for syslog/graylog/log_to_mon
e.who = parent->get_myinst();
+ e.name = parent->get_myname();
e.seq = parent->get_next_seq();
e.prio = prio;
e.msg = s;
return messenger->get_myinst();
}
+const EntityName& LogClient::get_myname()
+{
+ return cct->_conf->name;
+}
+
bool LogClient::handle_log_ack(MLogAck *m)
{
Mutex::Locker l(log_lock);
uint64_t get_next_seq();
const entity_inst_t& get_myinst();
+ const EntityName& get_myname();
version_t queue(LogEntry &entry);
private:
void LogEntry::encode(bufferlist& bl, uint64_t features) const
{
- ENCODE_START(3, 2, bl);
+ ENCODE_START(4, 2, bl);
__u16 t = prio;
::encode(who, bl, features);
::encode(stamp, bl);
::encode(t, bl);
::encode(msg, bl);
::encode(channel, bl);
+ ::encode(name, bl);
ENCODE_FINISH(bl);
}
void LogEntry::decode(bufferlist::iterator& bl)
{
- DECODE_START_LEGACY_COMPAT_LEN(3, 2, 2, bl);
+ DECODE_START_LEGACY_COMPAT_LEN(4, 2, 2, bl);
__u16 t;
::decode(who, bl);
::decode(stamp, bl);
// clue of what a 'channel' is.
channel = CLOG_CHANNEL_CLUSTER;
}
+ if (struct_v >= 4) {
+ ::decode(name, bl);
+ }
DECODE_FINISH(bl);
}
void LogEntry::dump(Formatter *f) const
{
f->dump_stream("who") << who;
+ f->dump_stream("name") << name;
f->dump_stream("stamp") << stamp;
f->dump_unsigned("seq", seq);
f->dump_string("channel", channel);
#include "include/utime.h"
#include "msg/msg_types.h" // for entity_inst_t
+#include "common/entity_name.h"
namespace ceph {
class Formatter;
struct LogEntry {
entity_inst_t who;
+ EntityName name;
utime_t stamp;
uint64_t seq;
clog_type prio;
inline ostream& operator<<(ostream& out, const LogEntry& e)
{
- return out << e.stamp << " " << e.who << " " << e.seq << " : "
+ return out << e.stamp << " " << e.name << " " << e.who
+ << " " << e.seq << " : "
<< e.channel << " " << e.prio << " " << e.msg;
}
dout(10) << "create_initial -- creating initial map" << dendl;
LogEntry e;
memset(&e.who, 0, sizeof(e.who));
+ e.name = g_conf->name;
e.stamp = ceph_clock_now();
e.prio = CLOG_INFO;
std::stringstream ss;
cmd_getval(g_ceph_context, cmdmap, "logtext", logtext);
LogEntry le;
le.who = m->get_orig_source_inst();
+ le.name = session->entity_name;
le.stamp = m->get_recv_stamp();
le.seq = 0;
le.prio = CLOG_INFO;