Summary

The createCustomLinkInteraction() mutation creates a custom link interaction and associates it with a LogScale repository in a single operation. Custom link interactions define URL templates that generate clickable links from event field values in search results. The URL template uses {{ fields.fieldName }} placeholders, which LogScale replaces with the corresponding field values when rendering results.

Syntax

graphql
createCustomLinkInteraction(
      input: CreateCustomLinkInteractionInput!
   ): InteractionId!

The mutation accepts a single required input argument of type CreateCustomLinkInteractionInput!. The input includes a path field that identifies the target repository and a customLinkInteractionInput object that contains the interaction name, URL template, and other settings. See the Input Parameters section for the full list of fields.

The mutation returns an InteractionId! object. Request the id field to obtain the unique identifier of the newly created interaction. Use this identifier in subsequent calls to updateCustomLinkInteraction() or deleteInteractionV2().

Example

Raw
graphql
mutation {
  createCustomLinkInteraction(input:
     { path: "humio",
       customLinkInteractionInput:{name: "my-interaction", openInNewTab: true,
                                   urlTemplate: "https://company.com?q={{ fields.myField }}"},
     } )
  { id }
}
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 {
  createCustomLinkInteraction(input:
     { path: \"humio\",
       customLinkInteractionInput:{name: \"my-interaction\", openInNewTab: true,
                                   urlTemplate: \"https://company.com?q={{ fields.myField }}\"},
     } )
  { id }
}"
}
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 {
  createCustomLinkInteraction(input:
     { path: \"humio\",
       customLinkInteractionInput:{name: \"my-interaction\", openInNewTab: true,
                                   urlTemplate: \"https://company.com?q={{ fields.myField }}\"},
     } )
  { id }
}"
}
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 { ^
  createCustomLinkInteraction(input: ^
     { path: \"humio\", ^
       customLinkInteractionInput:{name: \"my-interaction\", openInNewTab: true, ^
                                   urlTemplate: \"https://company.com?q={{ fields.myField }}\"}, ^
     } ) ^
  { id } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  createCustomLinkInteraction(input:
     { path: \"humio\",
       customLinkInteractionInput:{name: \"my-interaction\", openInNewTab: true,
                                   urlTemplate: \"https://company.com?q={{ fields.myField }}\"},
     } )
  { id }
}"
}'
    "$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 {
  createCustomLinkInteraction(input:
     { path: \"humio\",
       customLinkInteractionInput:{name: \"my-interaction\", openInNewTab: true,
                                   urlTemplate: \"https://company.com?q={{ fields.myField }}\"},
     } )
  { id }
}";
$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 {
  createCustomLinkInteraction(input:
     { path: \"humio\",
       customLinkInteractionInput:{name: \"my-interaction\", openInNewTab: true,
                                   urlTemplate: \"https://company.com?q={{ fields.myField }}\"},
     } )
  { id }
}"
}'''

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 {
  createCustomLinkInteraction(input:
     { path: \"humio\",
       customLinkInteractionInput:{name: \"my-interaction\", openInNewTab: true,
                                   urlTemplate: \"https://company.com?q={{ fields.myField }}\"},
     } )
  { id }
}"
}
);


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": {
    "createCustomLinkInteraction": {
      "id": "abc123"
    }
  }
}

Input Parameters

The input argument accepts a CreateCustomLinkInteractionInput object. This object includes a path field that identifies the target repository and a customLinkInteractionInput object that specifies the interaction name, URL template, tab behavior, URL encoding, and match conditions. The URL template supports {{ fields.fieldName }} placeholders that LogScale replaces with event field values when rendering search results. The following tables describe the available fields and the sub-types they reference:

Table: CreateCustomLinkInteractionInput Input Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
customLinkInteractionInputCustomLinkInteractionInputyes Long-Term The custom link for interactions. See CustomLinkInteractionInput.
pathStringyes Long-Term The path for the link.

The CreateCustomLinkInteractionInput type references a CustomLinkInteractionInput sub-type. The following table describes that sub-type:

Table: CustomLinkInteractionInput Input Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
fieldInteractionConditionsFieldInteractionConditionInputyes Long-Term The field interaction conditions. See FieldInteractionConditionInput.
nameStringyes Long-Term The name of the field.
openInNewTabBooleanyes Long-Term Whether to open in a new tab.
titleTemplateString  Long-Term The title template.
urlEncodeArgsBoolean  Long-Term The URL encode arguments.
urlTemplateStringyes Long-Term The URL template.

Returned Values

The mutation returns an InteractionId! object containing the unique identifier of the newly created custom link interaction. Request the id field to obtain this value. Use the identifier in subsequent calls to updateCustomLinkInteraction() or deleteInteractionV2(). The following table describes the returned type:

Table: InteractionId Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
idStringyes Long-Term The unique identifier for the interaction.