void LogEntry::encode(bufferlist& bl) const
{
- ENCODE_START(2, 2, bl);
+ ENCODE_START(3, 2, bl);
__u16 t = prio;
::encode(who, bl);
::encode(stamp, bl);
::encode(seq, bl);
::encode(t, bl);
::encode(msg, bl);
+ ::encode(channel, bl);
ENCODE_FINISH(bl);
}
void LogEntry::decode(bufferlist::iterator& bl)
{
- DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl);
+ DECODE_START_LEGACY_COMPAT_LEN(3, 2, 2, bl);
__u16 t;
::decode(who, bl);
::decode(stamp, bl);
::decode(t, bl);
prio = (clog_type)t;
::decode(msg, bl);
+ if (struct_v >= 3) {
+ ::decode(channel, bl);
+ }
DECODE_FINISH(bl);
}
f->dump_stream("who") << who;
f->dump_stream("stamp") << stamp;
f->dump_unsigned("seq", seq);
+ f->dump_string("channel", channel);
f->dump_stream("priority") << prio;
f->dump_string("message", msg);
}
CLOG_ERROR = 4,
} clog_type;
+static const std::string CLOG_CHANNEL_NONE = "none";
+static const std::string CLOG_CHANNEL_DEFAULT = "default";
+static const std::string CLOG_CHANNEL_CLUSTER = "cluster";
+static const std::string CLOG_CHANNEL_AUDIT = "audit";
+
/*
* Given a clog log_type, return the equivalent syslog priority
*/
string clog_type_to_string(clog_type t);
+
struct LogEntryKey {
entity_inst_t who;
utime_t stamp;
uint64_t seq;
clog_type prio;
string msg;
+ string channel;
LogEntryKey key() const { return LogEntryKey(who, stamp, seq); }
inline ostream& operator<<(ostream& out, const LogEntry& e)
{
return out << e.stamp << " " << e.who << " " << e.seq << " : "
- << e.prio << " " << e.msg;
+ << e.channel << " " << e.prio << " " << e.msg;
}
#endif
public:
uuid_d fsid;
version_t last;
-
+ std::string channel;
+
MLogAck() : Message(MSG_LOGACK) {}
MLogAck(uuid_d& f, version_t l) : Message(MSG_LOGACK), fsid(f), last(l) {}
private:
void encode_payload(uint64_t features) {
::encode(fsid, payload);
::encode(last, payload);
+ ::encode(channel, payload);
}
void decode_payload() {
bufferlist::iterator p = payload.begin();
::decode(fsid, p);
::decode(last, p);
+ if (!p.end())
+ ::decode(channel, p);
}
};