Summary

Search link interactions add clickable links to LogScale search results. When a user selects a field value that matches a defined condition, LogScale runs a preconfigured query and opens the results in the target repository or view. Use search link interactions to navigate from events in one repository to related data in the same or a different repository.

The createSearchLinkInteraction() mutation creates a new search link interaction. The path field in the input identifies the repository or view where the interaction is defined. The repoOrViewName field identifies the repository or view where the query runs when the link is selected — these values can differ, which enables cross-repository navigation. On success, the mutation returns an InteractionId! object containing the unique identifier of the new interaction.

Syntax

graphql
createSearchLinkInteraction(
      input: CreateSearchLinkInteractionInput!
   ): InteractionId!

The input argument is required and accepts a CreateSearchLinkInteractionInput! object. The path field identifies the repository or view where the interaction is defined. The repoOrViewName field within searchLinkInteractionInput identifies the repository or view where the query runs when the link is selected; these two values can differ. The conditions field maps field names in search results to argument names in the query string — when a user selects a matching field value, LogScale substitutes it as the argument value and runs the query. See the Input Parameters section for the full field reference.

The mutation returns a non-nullable InteractionId! object. If the mutation fails, the response contains errors rather than a null value. See the Returned Values section for the fields available on the returned type.

Example

Raw
graphql
mutation {
  createSearchLinkInteraction(input:
       { path: "humio",
         searchLinkInteractionInput: { 
             name: "my-search-link", 
             repoOrViewName: "humio", 
             isLive: true, openInNewTab: true,
             useWidgetTimeWindow: true,
             queryString: "#vhost",
             arguments: [ {key: "some", value: "thing"} ] }
      } )
  { 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 {
  createSearchLinkInteraction(input:
       { path: \"humio\",
         searchLinkInteractionInput: { 
             name: \"my-search-link\", 
             repoOrViewName: \"humio\", 
             isLive: true, openInNewTab: true,
             useWidgetTimeWindow: true,
             queryString: \"#vhost\",
             arguments: [ {key: \"some\", value: \"thing\"} ] }
      } )
  { 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 {
  createSearchLinkInteraction(input:
       { path: \"humio\",
         searchLinkInteractionInput: { 
             name: \"my-search-link\", 
             repoOrViewName: \"humio\", 
             isLive: true, openInNewTab: true,
             useWidgetTimeWindow: true,
             queryString: \"#vhost\",
             arguments: [ {key: \"some\", value: \"thing\"} ] }
      } )
  { 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 { ^
  createSearchLinkInteraction(input: ^
       { path: \"humio\", ^
         searchLinkInteractionInput: {  ^
             name: \"my-search-link\",  ^
             repoOrViewName: \"humio\",  ^
             isLive: true, openInNewTab: true, ^
             useWidgetTimeWindow: true, ^
             queryString: \"#vhost\", ^
             arguments: [ {key: \"some\", value: \"thing\"} ] } ^
      } ) ^
  { id } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  createSearchLinkInteraction(input:
       { path: \"humio\",
         searchLinkInteractionInput: { 
             name: \"my-search-link\", 
             repoOrViewName: \"humio\", 
             isLive: true, openInNewTab: true,
             useWidgetTimeWindow: true,
             queryString: \"#vhost\",
             arguments: [ {key: \"some\", value: \"thing\"} ] }
      } )
  { 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 {
  createSearchLinkInteraction(input:
       { path: \"humio\",
         searchLinkInteractionInput: { 
             name: \"my-search-link\", 
             repoOrViewName: \"humio\", 
             isLive: true, openInNewTab: true,
             useWidgetTimeWindow: true,
             queryString: \"#vhost\",
             arguments: [ {key: \"some\", value: \"thing\"} ] }
      } )
  { 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 {
  createSearchLinkInteraction(input:
       { path: \"humio\",
         searchLinkInteractionInput: { 
             name: \"my-search-link\", 
             repoOrViewName: \"humio\", 
             isLive: true, openInNewTab: true,
             useWidgetTimeWindow: true,
             queryString: \"#vhost\",
             arguments: [ {key: \"some\", value: \"thing\"} ] }
      } )
  { 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 {
  createSearchLinkInteraction(input:
       { path: \"humio\",
         searchLinkInteractionInput: { 
             name: \"my-search-link\", 
             repoOrViewName: \"humio\", 
             isLive: true, openInNewTab: true,
             useWidgetTimeWindow: true,
             queryString: \"#vhost\",
             arguments: [ {key: \"some\", value: \"thing\"} ] }
      } )
  { 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": {
    "createSearchLinkInteraction": {
      "id": "abc123"
    }
  }
}

Input Parameters

The input argument accepts a CreateSearchLinkInteractionInput! object. The path field specifies the repository or view where the interaction is defined. The nested searchLinkInteractionInput object contains the interaction details: the name, target repository or view (repoOrViewName), query string, live mode setting (isLive), tab behavior (openInNewTab), widget time window behavior (useWidgetTimeWindow), query arguments, and conditions. Conditions map field names in search results to argument names referenced in the query string. The following table describes the input fields:

Table: CreateSearchLinkInteractionInput Input Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
pathStringyes Long-Term The path for the link.
searchLinkInteractionInputSearchLinkInteractionInputyes Long-Term The search link. See SearchLinkInteractionInput.

Returned Values

The mutation returns an InteractionId! object containing the unique identifier of the created search link interaction. The return type is non-nullable — on failure, the response contains errors rather than a null value. Use the returned identifier in subsequent calls to updateSearchLinkInteraction() or deleteInteractionV2(). The following table describes the fields available on the returned type:

Table: InteractionId Datatype

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