
YongL.22948 (Customer) asked a question.
Hi Okta tech experts, thank you in advance!
Programmatically calling system log API's returns "time out" error. But using Postman works fine!!
We built a .net core 5.0 console application to pull down events using system log API's. It's been running well. But starting a day ago, it stopped working.
Domain is https://ourcompany.okta.com
We use a security API token (Authorization SSWS {{ApiToken}}).
Programmatically we instantiate an OktaClient object
var client = new OktaClient(new OktaClientConfiguration
{
OktaDomain = _config["OktaInfo:OktaDomain"],
Token = _config["OktaInfo:ApiToken"]
});
Then to retrieve logs:
var logs = await client.Logs
.GetLogs(since: $"{dt.AddHours(-1).ToUniversalTime().ToString("o")}"
, filter: "eventType eq \"user.session.start\" and outcome.result eq \"SUCCESS\""
, until: $"{dt.ToUniversalTime().ToString("o")}")
.ToArrayAsync();
The exception returns {"The request was canceled due to the configured HttpClient.Timeout of 30 seconds elapsing."}
However, if I use Postman, the call with the endpoint works!!
https://ourcompany.okta.com/api/v1/logs?filter=eventType eq "user.session.start"&since=2022-05-27T05:00:00Z&until=2022-05-28T05:00:00Z
Anyone ran into issues like this? Any help or clue would be greatly appreciated!
Best regards,

Hello @YongL.22948 (Customer) Thank you for reaching out to our Community!
From the error you are receiving the call waited 30 seconds for a response and since it never received one it timed out. The reason for this could be slow internet connection, file is too large or modifications to you network that could block the request(ports are not forwarded correctly or you have a firewall / other security tool blocking the connection). Since this worked, please review the application and see what was changed that could have cause this issue and undo the changes to see if that was causing the issue.
Also for alternatives to retrieve the logs please see:
https://support.okta.com/help/s/article/Exporting-Okta-Log-Data?language=en_US
https://developer.okta.com/docs/reference/api/system-log/
Hi Paul, thank you so much for responding.
However my question is why Postman works if some configurations block the connection? I ran the Postman and console program on the same development environment - the console program returns the "time-out" error. If you could shed some light, it would be greatly appreciated.
Best regards,
Yong Li, Winstead PC