Pagerduty and Nested Tables

Hi,

I am trying to create a PagerDuty INC using Sumologic. INC creation works fine, but I want PagerDuty to contain a nested table of some data.

For example:

Rather than PG displaying the raw JSON, I want a nested table instead. I know this is possible as the Site24x7 out of the box integration has nested tables. I just think my current syntax is incorrect.

Right now, this is the PG payload I am using:
{
“service_key”: “XXXXX”,
“event_type”: “trigger”,
“description”: “{{TriggerType}} Alert:{{AlertName}}”,
“client”: “Sumo Logic”,
“client_url”: “{{AlertResponseURL}}”,
“details”: {
“alertURL”: “{{AlertResponseURL}}”,
“triggerCondition”: “{{TriggerCondition}}”,
“triggerValue”: “{{TriggerValue}}”,
“triggerTime”: “{{TriggerTime}}”,
“triggerTimeRange”: “{{TriggerTimeRange}}”,
“query” : “{{Query}}”,
“queryUrl” : “{{QueryURL}}”,
“results”: “{{ResultsJSON}}”
}
}

But PG never creates a sub table. {{ResultsJSON}} is a variable which contains the json results e.g.

[
{
“Category”: “linux/system”,
“Collector”: “XXX”,
“Host”: “XXX”,
“Message”: “2022-06-17T01:58:46.525081+00:00 XXX bash[1236]: XXX:1168:/root:logger “mysql””,
“Name”: “/var/log/messages”,
“Time”: 1655431126525
}
]

Could you please suggest how to format the PG payload in order to create nested tables?

Note also we are using events v2 API.

I got it working (using test function) if the content under “results” is NOT an array. If it is an array, it doesn’t create a nested table :frowning:

Any work around for this?

HI Steve,
you can place your nested JSON inside the custom_details like this

{
"payload": {
    "summary": "Example of nesting",
    "timestamp": "2015-07-17T08:42:58.315+0000",
    "source": "monitoringtool:cloudvendor:central-region-dc-01:852559987:cluster/api-stats-prod-003",
    "severity": "info",
    "component": "postgres",
    "group": "prod-datapipe",
    "class": "deploy",
    "custom_details": {
        "Category": "linux/system",
        "Collector": "XXX",
        "Host": "XXX",
        "Message": "2022-06-17T01: 58: 46.525081+00: 00 XXX bash[1236]: XXX: 1168:/root:logger 'mysql'",
"Name": "/var/log/messages",
    "Time": 1655431126525
}
},
"routing_key": "MYROUTINGKEY",
"dedup_key": "mydedupekey",
"images": [
{
    "src": "https://www.pagerduty.com/wp-content/uploads/2016/05/pagerduty-logo-green.png",
    "href": "https://example.com/",
    "alt": "Example text"
}
],
"links": [
{
    "href": "https://example.com/",
    "text": "Link text"
}
],
"event_action": "trigger",
"client": "Sample Monitoring Service",
"client_url": "https://monitoring.example.com"
}

for additional context check out the API Documentation
Send an event to PagerDuty

hope this helps

Hi Sean,

Thanks, yep, I did figure that out. However, if the data is an array i.e [], PagerDuty just shows the actual array.

Does it support making an array into many sub tables?

Hi Steve
My understanding is if you add the array directly it shows as a blob, I would recommend formatting the json to have individual records like this

  "custom_details": {
            "Event1": {
                "Category": "linux/system",
                "Collector": "XXX",
                "Host": "host1",
                "Message": "2022-06-17T01: 58: 46.525081+00: 00 XXX bash[1236]: XXX: 1168:/root:logger 'mysql'",
                "Name": "/var/log/messages",
                "Time": 1655431126525},
    
    
            "Event2": {
                "Category": "linux/system",
                "Collector": "XXX",
                "Host": "host2",
                "Message": "2022-06-17T01: 58: 46.525081+00: 00 XXX bash[1236]: XXX: 1168:/root:logger 'mysql'",
                "Name": "/var/log/messages",
                "Time": 1655431126525
            }
            

        }

Ah thats unfortunate - this is set by Sumologic and I have no control over it. Is there a way I can submit a feature request for this?

Hello Steve,

This is Qisthy from the Support team.

Please feel free to submit a ticket to us at support@pagerduty.com so we can submit a feature request on your behalf!

Thanks,
Qisthy

Qisthy Kodarusman