Set up an audit log replay job
You can use the Konnect Audit Logs API to configure replay jobs for audit logging. Replay jobs allow you to get audit logs for a specific time period in the past.
Replay jobs are useful when you have missed audit log entries due to an error or a misconfigured audit
log webhook. You may have one replay job at a time per region, and request data from up to one week ago.
A replay job in a region will resend data for the requested timeframe to the webhook configured for that region.
Prerequisites
- From the navigation menu, open Organization, then Audit Logs Setup.
- On the Konnect tab, click the Replay tab for the region webhook that you want to replay.
-
Choose a timeframe for which you want to replay the logs.
You can choose one of the preset relative increments for up to 24 hours, or
set a custom timeframe for up to 7 days.
- Apply the timeframe, then click Send Replay.
Configure the replay job for a region by sending a PUT
request to the /audit-log-replay-job
endpoint in the region where you want to retrieve data:
curl -i -X PUT https://{region}.api.konghq.com/v2/audit-log-replay-job \
--header "Content-Type: application/json" \
--header "Authorization: Bearer <personal-access-token>" \
--data '{
"start_at": "2023-03-27T20:00:00Z",
"end_at": "2023-03-27T20:00:00Z"
}'
Be sure to replace the following placeholder values:
-
{region}.api.konghq.com
: The region your portal is located in. Can be us
, ap
, or eu
.
-
<personal-access-token>
: Your Konnect personal access token (PAT).
-
{portalId}
: The ID of the Dev Portal with your webhook.
-
start_at
and end_at
: Specify the timeframe for which you want to receive audit log events. start_at
must be no more than seven days ago.
If the request is successful, you will receive a 202
response code and a response body containing the replay job details.
View replay job
- From the navigation menu, open Organization, then Audit Logs Setup.
- Switch to the Replay tab.
- Check the status table below the configuration field.
You can view the audit log replay job in a given region by issuing a GET request to the audit-log-replay-job
endpoint:
curl https://{region}.api.konghq.com/v2/audit-log-replay-job \
--header "Authorization: Bearer <personal-access-token>"
Be sure to replace the following placeholder values:
-
{region}.api.konghq.com
: The region your portal is located in. Can be us
, ap
, or eu
.
-
<personal-access-token>
: Your Konnect personal access token (PAT).
You will receive a 200
response code and the job details.
Replay job status
A replay job can be in one of the following statuses:
Status |
Description |
unconfigured |
Initial state. The job has not been set up. |
accepted |
The job has been accepted for scheduling. |
pending |
The job has been scheduled. |
running |
The job is in progress. When a replay job is running , a request to update the job will return a 409 response code until it has completed or failed. |
completed |
The job has finished with no errors. |
failed |
The job has failed. |