user list

Asked by Sam Fineberg on 2012-12-11

Is there a way to get a list of the users that have objects stored within a swift cluster? We want to do some per-user accounting/statistics and couldn't find a straightforward way to get the user list out. We don't want to just ask keystone since it may include users that haven't touched swift, and it may miss some users that are no longer active.

Thanks,
Sam

Question information

Language:
English Edit question
Status:
Answered
For:
OpenStack Object Storage (swift) Edit question
Assignee:
No assignee Edit question
Last query:
2012-12-11
Last reply:
2012-12-17
Samuel Merritt (torgomatic) said : #1

Well, there's no easy way, but there is a way.

You can find all the account databases on a node by looking in /srv/node/*/accounts/**/*.db (e.g. "find /srv/node/*/accounts -name '*.db'"), and then query each one of those for its account name ("SELECT account FROM account_stat"). Do that across all your nodes and deduplicate the list, and you've got all the accounts in your system.

With that in hand, you can do a series of HEAD requests to see how much stuff is stored under each account.

Sam Fineberg (fineberg) said : #2

This is kind of what I expected, but not what I wanted. Maybe its time to write a blueprint for an easier way to do this.

Samuel Merritt (torgomatic) said : #3

Sure. If you want to have a go at coding it yourself, one fairly easy way would be to make the account auditor log the name of the account it's auditing (in, say, AccountAuditor.account_audit). Then getting a list of all accounts becomes a matter of log parsing.

I've only spent a minute or two thinking about this, though, so don't take the above as some sort of hard requirement. :)

clayg (clay-gerrard) said : #4

Doesn't slogging already make a pretty good run at this?

https://github.com/notmyname/slogging/blob/master/slogging/db_stats_collector.py

Can you help with this problem?

Provide an answer of your own, or ask Sam Fineberg for more information if necessary.

To post a message you must log in.