Summary

PagerDuty actions send alert notifications to PagerDuty when a LogScale alert triggers. Each action uses a routing key to authenticate with a PagerDuty service integration and a severity level to classify the resulting incident.

The updatePagerDutyAction() mutation replaces the full set of properties on an existing PagerDuty action in a LogScale view. You must supply all required fields — including the name, severity, routing key, and proxy setting — because the mutation performs a full replace, not a partial update. To create a new PagerDuty action, use createPagerDutyAction() instead.

Syntax

graphql
updatePagerDutyAction(
      input: UpdatePagerDutyAction!
   ): PagerDutyAction!

The input argument is required and takes an UpdatePagerDutyAction! object. Provide the view name, the unique identifier of the action, and all required fields. The mutation performs a full replace, so you must include every required field or the mutation returns an error.

Input parameters

Provide the view name, the unique identifier of the action, and all required fields. The severity field accepts the PagerDuty severity levels critical, error, warning, and info. The routingKey field is the integration key from your PagerDuty service. To find the action identifier, use the repository() query and inspect the id field.

Table: UpdatePagerDutyAction Input Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
idStringyes Long-Term The unique identifier of the action.
labelsStringyes   Labels to categorize the action.
nameStringyes Long-Term The name of the action.
routingKeyStringyes Long-Term The routing key to authenticate with PagerDuty.
severityStringyes Long-Term The severity level to pass to the message.
useProxyBooleanyes Long-Term Defines whether the action should use the configured proxy to make web requests.
viewNameStringyes Long-Term The name of the view of the action.

Example

Raw
graphql
mutation {
  updatePagerDutyAction( input:
      { viewName: "humio",
        id: "abc123",
        name: "Your-Turn",
        severity: "Important",
        routingKey: "def456",
        useProxy: false
      }
  )
  { severity }
}
Mac OS or Linux (curl)
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d @- << EOF
{"query" : "mutation {
  updatePagerDutyAction( input:
      { viewName: \"humio\",
        id: \"abc123\",
        name: \"Your-Turn\",
        severity: \"Important\",
        routingKey: \"def456\",
        useProxy: false
      }
  )
  { severity }
}"
}
EOF
Mac OS or Linux (curl) One-line
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d @- << EOF
{"query" : "mutation {
  updatePagerDutyAction( input:
      { viewName: \"humio\",
        id: \"abc123\",
        name: \"Your-Turn\",
        severity: \"Important\",
        routingKey: \"def456\",
        useProxy: false
      }
  )
  { severity }
}"
}
EOF
Windows Cmd and curl
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql ^
    -H "Authorization: Bearer $TOKEN" ^
    -H "Content-Type: application/json" ^
    -d @'{"query" : "mutation { ^
  updatePagerDutyAction( input: ^
      { viewName: \"humio\", ^
        id: \"abc123\", ^
        name: \"Your-Turn\", ^
        severity: \"Important\", ^
        routingKey: \"def456\", ^
        useProxy: false ^
      } ^
  ) ^
  { severity } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  updatePagerDutyAction( input:
      { viewName: \"humio\",
        id: \"abc123\",
        name: \"Your-Turn\",
        severity: \"Important\",
        routingKey: \"def456\",
        useProxy: false
      }
  )
  { severity }
}"
}'
    "$YOUR_LOGSCALE_URL/graphql"
Perl
perl
#!/usr/bin/perl

use HTTP::Request;
use LWP;

my $TOKEN = "TOKEN";

my $uri = '$YOUR_LOGSCALE_URL/graphql';

my $query = "mutation {
  updatePagerDutyAction( input:
      { viewName: \"humio\",
        id: \"abc123\",
        name: \"Your-Turn\",
        severity: \"Important\",
        routingKey: \"def456\",
        useProxy: false
      }
  )
  { severity }
}";
$query =~ s/\n/ /g;
my $json = sprintf('{"query" : "%s"}',$query);
my $req = HTTP::Request->new("POST", $uri );

$req->header("Authorization" => "Bearer $TOKEN");
$req->header("Content-Type" => "application/json");

$req->content( $json );

my $lwp = LWP::UserAgent->new;

my $result = $lwp->request( $req );

print $result->{"_content"},"\n";
Python
python
#! /usr/local/bin/python3

import requests

url = '$YOUR_LOGSCALE_URL/graphql'
mydata = r'''{"query" : "mutation {
  updatePagerDutyAction( input:
      { viewName: \"humio\",
        id: \"abc123\",
        name: \"Your-Turn\",
        severity: \"Important\",
        routingKey: \"def456\",
        useProxy: false
      }
  )
  { severity }
}"
}'''

resp = requests.post(url,
                     data = mydata,
                     headers = {
   "Authorization" : "Bearer $TOKEN",
   "Content-Type" : "application/json"
}
)

print(resp.text)
Node.js
javascript
const https = require('https');

const data = JSON.stringify(
    {"query" : "mutation {
  updatePagerDutyAction( input:
      { viewName: \"humio\",
        id: \"abc123\",
        name: \"Your-Turn\",
        severity: \"Important\",
        routingKey: \"def456\",
        useProxy: false
      }
  )
  { severity }
}"
}
);


const options = {
  hostname: '$YOUR_LOGSCALE_URL',
  path: 'graphql',
  port: 443,
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Content-Length': data.length,
    Authorization: 'BEARER ' + process.env.TOKEN,
    'User-Agent': 'Node',
  },
};

const req = https.request(options, (res) => {
  let data = '';
  console.log(`statusCode: ${res.statusCode}`);

  res.on('data', (d) => {
    data += d;
  });
  res.on('end', () => {
    console.log(JSON.parse(data).data);
  });
});

req.on('error', (error) => {
  console.error(error);
});

req.write(data);
req.end();
Example Responses
Success (HTTP Response Code 200 OK)
json
{
  "data": {
    "updatePagerDutyAction": {
      "severity": "Important"
    }
  }
}

Returned values

The mutation returns the updated PagerDutyAction! object. Include severity, routingKey, and name in the return fields to confirm the changes. Include modifiedInfo to verify the modification timestamp and the user who made the change.

Table: PagerDutyAction Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
allowedActions[AssetAction]yes Short-Term The asset actions allowed. See AssetAction .
createdInfoAssetCommitMetadata  Long-Term Metadata related to the creation of the action. See AssetCommitMetadata.
displayNamestringyes Long-Term The display name of the action.
idstringyes Long-Term The unique identifier of the action.
isAllowedToRunbooleanyes Long-Term False if this type of action is disabled because of a security policy, true otherwise.
labels[string]  Preview Any labels associated with the action.
modifiedInfoAssetCommitMetadata  Long-Term Metadata related to the latest modification of the action. See AssetCommitMetadata.
namestringyes Long-Term The name of the action.
packagePackageInstallationyes Long-Term The package, if any, of which the action is part. See PackageInstallation.
packageIdVersionedPackageSpecifier  Long-Term The identifier of the package, if any. VersionedPackageSpecifier is a scalar.
requiresOrganizationOwnedQueriesPermissionToEditbooleanyes Long-Term True if this action is used by triggers, where the query is run by the organization. If true, then the OrganizationOwnedQueries permission is required to edit the action.
resourcestringyes Short-Term The resource identifier for the action.
routingKeystringyes Long-Term Routing key to authenticate with PagerDuty.
severitystringyes Long-Term Severity level to give to the message.
useProxybooleanyes Long-Term Defines whether the action should use the configured proxy to make web requests.
yamlTemplateYAMLyes Long-Term A template that can be used to recreate the action. YAML is a scalar.