Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get-OktaLogs changes the required date format for "since" and "until" query params #55

Open
laura-rodriguez opened this issue Oct 21, 2024 · 1 comment

Comments

@laura-rodriguez
Copy link
Collaborator

The Logs API requires the format for date query params to be ISO8601 (i.e. 2024-10-21T16:24:13Z or Get-Date (Get-Date).ToUniversalTime() -UFormat '+%Y-%m-%dT%H:%M:%SZ'). The existing Get-OktaLogs cmdlet doesn't preserve formats, causing the API call to fail.
There are several routes we can explore to fix the issue:

  • Update the Cmdlet interface to receive strings instead of dates:
$until = $dateTo.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
$since = $dateFrom.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")

Get-OktaLogs -since $since -until $until
  • Keep the same Cmdlet interface but address the format internally
Get-OktaLogs -since $sinceUtcDate -until $untilUtcDate

//OktaSystemLogApi.ps1
// Assume $Since is already in UTC format
 if ($Since) {
            $LocalVarQueryParameters['since'] = $Since.ToString("yyyy-MM-ddTHH:mm:ssZ")
        }

We should update docs to show examples of how to use the logs cmdlets

@laura-rodriguez
Copy link
Collaborator Author

Internal Ref: OKTA-821497

laura-rodriguez added a commit that referenced this issue Dec 16, 2024
…m release 2024.08.3). Since and Until query params are now strings.

- Update the README file with usage info
- Fix 821497 and #55
laura-rodriguez added a commit that referenced this issue Dec 19, 2024
…ce-until-query-params

Fix: Get-OktaLogs changes the required date format for "since" and "until" query params #55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant