Skip to content

mon: use structure encoded mechanism for audit logs - #69052

Closed
vshankar wants to merge 2 commits into
ceph:mainfrom
vshankar:wip-71850
Closed

vshankar wants to merge 2 commits into
ceph:mainfrom
vshankar:wip-71850

Conversation

@vshankar

Copy link
Copy Markdown
Contributor

Fixes: http://tracker.ceph.com/issues/71850

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 x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@vshankar
vshankar requested a review from a team as a code owner May 22, 2026 05:41
@vshankar vshankar added the core label May 22, 2026
@vshankar vshankar mentioned this pull request May 22, 2026
14 tasks
@vshankar
vshankar requested a review from rzarzynski May 22, 2026 05:46
@vshankar

Copy link
Copy Markdown
Contributor Author

@rzarzynski - appreciate if you could have a look at this. I am not sure if we also want to move the cluster log (clog) to use the new structure.

Comment thread src/common/LogClient.cc
void LogChannel::do_log(clog_type prio, LogMsg &&m) {
LogEntry e;
std::ostringstream oss;
oss << m;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::ostringstream are relatively expensive to construct. Suggest using CachedStackStringStream (which we use for all debugging messages).

Comment thread src/mon/Monitor.cc
LogMsg msg;
bool send_logmsg = false;
auto m = op->get_req<MMonCommand>();
std::ostringstream oss;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Comment thread src/common/LogEntry.h
void encode(bufferlist& bl, uint64_t features) const;
void decode(bufferlist::const_iterator& p);
};
WRITE_CLASS_ENCODER_FEATURES(LogMsg)

@batrick batrick May 22, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, I think the direction is reasonable but I don't think we want to make these highly-specific structures for each message type that we may want to put into the audit log channels. I'm pondering whether to just construct a json payload for each type of message we might put into the log channel. We'll always have the normal "string" that goes to the text log but you can enhance it with a payload that can be interpreted specifically by the mgr / auditmon module.

So in this case, you might include a payload like:

{
  "channel": "ceph_command",
  "data": {
    "cmd": ...,
    "cmd_args": ...
    // etc.
  }

So then the MDS can trivially add its own payload for tell commands, etc.

What do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds fine to me. Right now, what goes in cmd is actually the stringified json of the command which gets persisted in paxos store and will now be additionally recorded in sqlite (by ceph-mgr).

Just to be clear, you are suggesting that the LogMsg structure "carries" a JSON (as you describe above) and its stringified version ends up in paxos store and additionally the json binary ends up in sqlite.

Did I get that right?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so. The ceph-mgr should be smart enough to replay log messages that it has not persisted yet.

@github-actions

Copy link
Copy Markdown

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.
If you are a maintainer or core committer, please follow-up on this pull request to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@github-actions github-actions Bot added the stale label Jul 28, 2026
@github-actions

Copy link
Copy Markdown

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!

@github-actions github-actions Bot closed this Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants