[slurm-users] How to print a user's creation timestamp from the Slurm database?

Ole Holm Nielsen Ole.H.Nielsen at fysik.dtu.dk
Mon Jan 20 14:18:10 UTC 2020


Hi,

I have been exploring how to list Slurm "Add Users" transactions for a 
specified number of days/weeks/months into the past.  The "date" command 
is very flexible in printing days in the past.

Here are some examples:

# sacctmgr list transactions Action="Add Users" Start=`date -d "-1 month" 
+%m/%d/%y`
                Time               Action      Actor                Where 
                Info
------------------- -------------------- ---------- -------------------- 
--------------------
2020-01-07T08:50:46            Add Users       root                aaa 
    admin_level=1
2020-01-07T15:14:37            Add Users       root                bbb 
    admin_level=1
2020-01-09T11:15:17            Add Users       root                ccc 
    admin_level=1
2020-01-13T12:59:01            Add Users       root                ddd 
    admin_level=1
2020-01-15T10:00:01            Add Users       root                eee 
    admin_level=1

and so on with varying periods:

# sacctmgr list transactions Action="Add Users" Start=`date -d "-2 month" 
+%m/%d/%y`

# sacctmgr list transactions Action="Add Users" Start=`date -d "-45 days" 
+%m/%d/%y`

I think this pretty nicely gives us the flexibility for listing 
transactions during some period into the past.

/Ole

On 1/20/20 11:29 AM, Ole Holm Nielsen wrote:
> Hi Jürgen,
> 
> On 1/19/20 2:38 PM, Juergen Salk wrote:
>> * Ole Holm Nielsen <Ole.H.Nielsen at fysik.dtu.dk> [200118 12:06]:
>>
>>> When we have created a new Slurm user with "sacctmgr create user 
>>> name=xxx",
>>> I would like inquire at a later date about the timestamp for the user
>>> creation.  As far as I can tell, the sacctmgr command cannot show such
>>> timestamps.
>>
>> Hi Ole,
>>
>> for me (currently running Slurm version 19.05.2) the command
>>
>>   sacctmgr list transactions Action="Add Users"
>>
>> also shows timestamps. Isn't this what you are looking for?
> 
> This is indeed a hidden feature of Slurm!  The sacctmgr man-page has a 
> single example:
> 
> sacctmgr list transactions StartTime=11/03\-10:30:00 
> format=Timestamp,Action,Actor
> 
> This example is actually incorrect: StartTime should be Start and the 
> backslash \ should be removed.  Here is a correct example:
> 
> sacctmgr list transactions Action="Add Users" Start=01/01 format=where,time
> 
> This "sacctmgr list transactions" feature should be usable for my task at 
> hand.  If you want to know which users were added within the last 30 days, 
> you "just" have to calculate the appropriate Start time = (Now - 30 days) 
> for the above command.
> 
> One caveat is that users may have been added and then removed, but one can 
> list removed users by:
> 
> sacctmgr list transactions Action="Remove Users" Start=01/01 
> format=where,time
> 
> There is a different way reading the entire list of users directly from 
> the Slurm database with a mysql command, and I will post this method in a 
> separate mail.



More information about the slurm-users mailing list