Repository navigation
Conversation
addbe40 to
66c94e5
Compare
7a62b3d to
6a137bb
Compare
ae41aa2 to
9823851
Compare
bf18c77 to
059769d
Compare
de282ad to
1acbec2
Compare
|
Also see: #68384 |
| "seq INTEGER PRIMARY KEY, " | ||
| "cmd TEXT NOT NULL CHECK (length(trim(cmd)) > 0), " | ||
| "init_time INTEGER NOT NULL CHECK (init_time > 0), " | ||
| // second-phase commit therefore nullable until completion |
There was a problem hiding this comment.
Does it makes sense to update the original record on command completion or should that update be a separate record by itself? In either case, we need an identifier to map a completion record to its dispatch.
There was a problem hiding this comment.
on command completion, yes.
In either case, we need an identifier to map a completion record to its dispatch.
it will be tracked as per seq, the second_phase_commit() checks for it before commencing the update query
| row_count_mismatch, | ||
| /** `sqlite3_vfs_find("ceph")` returned null (VFS not registered) */ | ||
| ceph_vfs_not_found, | ||
| /** Ceph VFS has no `xDelete` implementation */ |
There was a problem hiding this comment.
What is xDelete and is there a reason we need is a failure reason during exception handling?
There was a problem hiding this comment.
xDelete is called by vfs to delete the underlying db file.
is there a reason we need is a failure reason during exception handling?
its good to know what failed while trying to delete a file, libcephsqlite already maps Delete() to xDelete() so chances of Ceph VFS not implementing xDelete is null but this check is more of a belt and suspenders approach
|
|
||
| struct AuditEntry { | ||
| int64_t seq{0}; | ||
| std::string cmd; |
There was a problem hiding this comment.
Needs a separate field for command arguments.
There was a problem hiding this comment.
args needs to be optional, right?
There was a problem hiding this comment.
or maybe i guess the daemon/tool can just mark it as blank with a {} or null
There was a problem hiding this comment.
this has been added, cmd_args as a string.
| using sqlite3_ptr = std::unique_ptr<sqlite3, decltype(&sqlite3_close)>; | ||
|
|
||
| struct AuditEntry { | ||
| int64_t seq{0}; |
There was a problem hiding this comment.
Additionally requires the paxos version for mon audit logs (which is different than the sequence number in LogEntry). For audit logs which are not relayed via mons, this version would be 0.
| } | ||
|
|
||
| // prepare phase-two statement | ||
| if (auto e = prepare_sqlite3_stmt( |
There was a problem hiding this comment.
How costly is an sqlite update as compared to a new row insertion?
There was a problem hiding this comment.
the update query makes use of seq (which is the primary key) and comp_time (which is indexed), i think the update should be same as insert
| // state. | ||
| initialised = true; | ||
| if (auto seq = get_last_committed_seq(); seq) { | ||
| last_seq = *seq; |
There was a problem hiding this comment.
This would be (paxos) version and not sequence. Also, the version is only valid for mon audit logs, so that would need special handling here (if not done already).
There was a problem hiding this comment.
considering your previous comments, im assuming more changes in the functions for handling mon logs. keep adding as things come to mind.
There was a problem hiding this comment.
this has been removed
Fixes: https://tracker.ceph.com/issues/71849 Signed-off-by: Dhairya Parmar <[email protected]>
Fixes: https://tracker.ceph.com/issues/71849 Signed-off-by: Dhairya Parmar <[email protected]>
a wrapper around AuditDB, consumers just need to call create_for_tool() or create(). Also linked it with all the cephfs tools binaries Fixes: https://tracker.ceph.com/issues/71849 Signed-off-by: Dhairya Parmar <[email protected]>
- add struct `tee_streambuf` in MDSUtility.h as file-scope entity, which is used to stream errors in both std::cerr and audit db (status field) via a new `std::ostream err` MDSUtility member making use of the new struct and an std::ostringstream. - MDSUtility is the common parent for most classes in cephfs tools except a few which inherit from class RecoveryDriver like LocalFileDriver and MetadataDriver, they have been enabled to forward a ref of `err` ostream from the place of call i.e. in DataScan.cc - certain error strings and buffer::error refs in catch block conflicted with new std::ostream `err`; had to be changed in DataScan.cc - also modularized creating and getting rados connection which is needed in calling ToolsAuditLogger::create_for_tool() Fixes: https://tracker.ceph.com/issues/71849 Signed-off-by: Dhairya Parmar <[email protected]>
|
UPDATE: With the latest commits - AuditDB integration with CephFS DR tools is complete (open for reviews!). The complete feature is obviously integration with MON (#68384) and MGR but the plan is to do a phased release with Phase-1 being AuditDB APIs + CephFS DR Tools integration + auditman mgr module (reading audit logs). Phase-2 will do the heavy lifting of integration with MON and MGR + an upkeep thread implemented in MGR to trim logs based on a conf val. cc @vshankar |
|
This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days. |
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
|
This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days. |
|
This pull request has been automatically closed because there has been no activity for 90 days. Please feel free to reopen this pull request (or open a new one) if the proposed change is still appropriate. Thank you for your contribution! |
This PR introduces APIs to enable writing audit logs into DBs backed by sqlite3 (via
libcephsqlitewhich enables a ceph VFS allowing us to decentralise the DBs using RADOS) and marks the first step towards implementing audit logging of cluster-wide commands and standalone tools, starting with CephFS: https://tracker.ceph.com/issues/62856.A talk on this topic was presented by me and @vshankar at FOSDEM 2026 which can be referred for more information about the objective, design and architecture of the entire feature.
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.