duosecurity/duo_client_python

get_authentication_log - api:v2 param filter failing

safehome-jdev opened this issue · 4 comments

Hello there,

I am unsure if the issue is just with me, but I am unable to review the last 15 minutes of authentication logs with a list of users or even a single user. The response always returns unfiltered, which contains users I did not specify. I've tried using a few different params to see what would work, but all of them return the same info.

Admin.get_authentication_logs

        API Version v2:
        mintime (required) - Unix timestamp in ms; fetch records >= mintime
        maxtime (required) - Unix timestamp in ms; fetch records <= maxtime
        limit - Number of results to limit to
        next_offset - Used to grab the next set of results from a previous response
        sort - Sort order to be applied
        users - List of user ids to filter on
        groups - List of group ids to filter on
        applications - List of application ids to filter on
        results - List of results to filter to filter on
        reasons - List of reasons to filter to filter on
        factors - List of factors to filter on
        event_types - List of event_types to filter on

here's what I got:

min = int(round(time.time() * 1000)) - 900000
max = int(round(time.time() * 1000))

def getAuthenticationLogs( user_id: list[str], event: None = "authentication"):
    with open("./logs.log", "w") as f:
        f.write(
            api.get_authentication_logs(
            api_version=2,
            mintime=min,
            maxtime=max, 
            users=["GEV31XY6KKH9DCBRL8UZ"]))
        f.close()

Any idea on what's going wrong?

@safehome-jdev I've been trying to reproduce this issue, but so far unsuccessfully. The user filtering is working as expected when I test it locally. I'll keep poking at it to see if I can cause the issue.

I would focus on the users parameter. The behavior you describe is what I would expect if that parameter was not being recognized by the get_authentication_log() method. Perhaps there's a typo in it? Maybe a copy paste issue picked up some non-printed character in the string? These are just wild guesses though.

@safehome-jdev any updates? I've still been unable to reproduce the issue.

Still not able to reproduce the issue.