Log entries for an incident aren't up-to-date when called by API

Hi there!

I currently have a bit of an issue: when I receive a webhook from PagerDuty, I need to be able to see who/what triggered the event that I am receiving. This is because I don’t want to process an event twice in the case where the event was created by my integration.

In V2, this was simple; log entries were sent with the V2 payload, so I would be able to pull that information directly from the payload when processing.

But in V3, no log entry info is provided so the only workaround I have been able to find is to make an API call to list the log entries associated with the incident that I received. This works about 30-40% of the time, but the other 60-70% of the time the most recent log entry does not reflect the log entry that I would expect to see, since I know that the event I am looking at was triggered by an integration.

I currently have a retry call implemented to increase the chances that PagerDuty will process the log entries in time to send me an up-to-date list, but even this hasn’t led to great results. Is there a better way to retrieve the log entries that would help guarantee that i receive an up-to-date list?

Thanks in advance for the help!

Hi Austin,

As detailed here, the webhooks contain fields which provide details you are after, including the integration it was triggered from.

Regarding Log Entries, the [List log entries for an incident]
(https://developer.pagerduty.com/api-reference/367602cbc1c28-list-log-entries-for-an-incident) endpoint should provide same details.

If that has not been your experience, as specific account details will be required, please email the Support Team, support@pagerduty.com and we will be happy to look into this with you.

Kind regards,

Hi Chiedu,

First, thank you for the response! I have looked at the payloads and it doesn’t seem like the log_entry channel information is actually relayed in the V3 payload. The “client” property seems to be the closest equivalent but, like the incident_key, it is always set to null in the webhooks I receive.

If you could provide any further clarity to which PagerDuty Webhook V3 payload property is equivalent to the “channel” property of the log entries provided by the Webhook V2 payload, that would be greatly appreciated!

And yes, that is the log entry endpoint that I am using but the information is either not sorted properly or is not up-to-date, so the first log entry does not reflect that the event was triggered by an integration. I have proof of this because I log the log_entries I receive on the first try and on the retry and I get different results between the two. This leads to the log entry endpoint being a little too unreliable for replicating the functionality of V2.

I would actually prefer to keep correspondence in the forum if possible because I don’t think that this issue is specific to my account and my past posts have been commented on by other engineers struggling with similar issues. If possible, I’d like to save those future engineers the headache and keep things well documented!

Thank you again for your time :slight_smile:

Hi Austin,

The v3 webhooks should be returning a client field the same way that v2 does. The agent field in v3 can also return information on the specific integration that triggered the incident. I did some testing on my end and both versions of the webhook returned the same field with the same data.

Can you provide more info on the type of integration you’re using to trigger incidents? I suspect that might affect what client returns.

Hey there @nadinej!

I really appreciate you reaching out and taking the time to test it all on your own end.

I use the V2 Events API to trigger incidents/alerts in PD. When doing this, the client field that I receive in the V3 payload is always null and the agent field is sometimes null. I’ve tried explicitly setting the client when sending the call to the V2 events api, but it doesn’t seem to make a difference. The incident_key field is also always null, but I have been able to workaround this.

In your testing, how were you able to get the same behavior from both V2 and V3? Is there a specific way of triggering incidents in PD that would allow me to get the same behavior across V2 and V3? I appreciate your help and sorry for the late response! I didn’t see your response when I checked back on the thread.

Bumping for attention if possible!

Definitely interested in hearing whether or not I will be able to get the same results in V2 and V3 while triggering events through the V2 events api

Hi Austin! Sorry for the delay.

I used the Events API to trigger my incidents in order to test this. We might need to get more details about your account and view your incident payloads in order to further advise. If you can please reach out to our Support team at support@pagerduty.com, we’d be happy to help!

Reached out earlier today. Thanks for the help, Nadine and Chiedu!