#define dout_subsys ceph_subsys_rgw
-class RGWRados;
+namespace rgw { namespace sal {
+ class Store;
+} }
struct rgw_log_entry {
rgw_user object_owner;
rgw_user bucket_owner;
- string bucket;
+ std::string bucket;
Clock::time_point time;
- string remote_addr;
- string user;
+ std::string remote_addr;
+ std::string user;
rgw_obj_key obj;
- string op;
- string uri;
- string http_status;
- string error_code;
+ std::string op;
+ std::string uri;
+ std::string http_status;
+ std::string error_code;
uint64_t bytes_sent = 0;
uint64_t bytes_received = 0;
uint64_t obj_size = 0;
Clock::duration total_time{};
- string user_agent;
- string referrer;
- string bucket_id;
+ std::string user_agent;
+ std::string referrer;
+ std::string bucket_id;
headers_map x_headers;
- string trans_id;
- std::vector<string> token_claims;
+ std::string trans_id;
+ std::vector<std::string> token_claims;
+ uint32_t identity_type;
+ std::string access_key_id;
+ std::string subuser;
+ bool temp_url {false};
void encode(bufferlist &bl) const {
- ENCODE_START(11, 5, bl);
+ ENCODE_START(13, 5, bl);
encode(object_owner.id, bl);
encode(bucket_owner.id, bl);
encode(bucket, bl);
encode(x_headers, bl);
encode(trans_id, bl);
encode(token_claims, bl);
+ encode(identity_type,bl);
+ encode(access_key_id, bl);
+ encode(subuser, bl);
+ encode(temp_url, bl);
ENCODE_FINISH(bl);
}
void decode(bufferlist::const_iterator &p) {
- DECODE_START_LEGACY_COMPAT_LEN(11, 5, 5, p);
+ DECODE_START_LEGACY_COMPAT_LEN(13, 5, 5, p);
decode(object_owner.id, p);
if (struct_v > 3)
decode(bucket_owner.id, p);
if (struct_v >= 11) {
decode(token_claims, p);
}
+ if (struct_v >= 12) {
+ decode(identity_type, p);
+ }
+ if (struct_v >= 13) {
+ decode(access_key_id, p);
+ decode(subuser, p);
+ decode(temp_url, p);
+ }
DECODE_FINISH(p);
}
void dump(ceph::Formatter *f) const;
- static void generate_test_instances(list<rgw_log_entry*>& o);
+ static void generate_test_instances(std::list<rgw_log_entry*>& o);
};
WRITE_CLASS_ENCODER(rgw_log_entry)
class OpsLogFile : public JsonOpsLogSink, public Thread, public DoutPrefixProvider {
CephContext* cct;
- ceph::mutex log_mutex = ceph::make_mutex("OpsLogFile_log");
- ceph::mutex flush_mutex = ceph::make_mutex("OpsLogFile_flush");
+ ceph::mutex mutex = ceph::make_mutex("OpsLogFile");
std::vector<bufferlist> log_buffer;
std::vector<bufferlist> flush_buffer;
- ceph::condition_variable cond_flush;
+ ceph::condition_variable cond;
std::ofstream file;
bool stopped;
uint64_t data_size;
uint64_t max_data_size;
+ std::string path;
+ std::atomic_bool need_reopen;
void flush();
protected:
CephContext *get_cct() const override { return cct; }
unsigned get_subsys() const override { return dout_subsys; }
std::ostream& gen_prefix(std::ostream& out) const override { return out << "rgw OpsLogFile: "; }
+ void reopen();
void start();
void stop();
};
};
class OpsLogRados : public OpsLogSink {
- RGWRados* store;
+ // main()'s Store pointer as a reference, possibly modified by RGWRealmReloader
+ rgw::sal::Store* const& store;
+
public:
- OpsLogRados(RGWRados* store);
+ OpsLogRados(rgw::sal::Store* const& store);
int log(struct req_state* s, struct rgw_log_entry& entry) override;
};
int rgw_log_op(RGWREST* const rest, struct req_state* s,
const std::string& op_name, OpsLogSink* olog);
-void rgw_log_usage_init(CephContext *cct, RGWRados *store);
+void rgw_log_usage_init(CephContext* cct, rgw::sal::Store* store);
void rgw_log_usage_finalize();
void rgw_format_ops_log_entry(struct rgw_log_entry& entry,
ceph::Formatter *formatter);