Summary

The updateEventForwardingRule() mutation edits an event forwarding rule on a repository. Call this mutation to change a rule's query string, destination, or other configuration. To create a new rule, use createEventForwardingRule().

Syntax

graphql
updateEventForwardingRule(
      input: UpdateEventForwardingRule!
   ): EventForwardingRule!

The mutation accepts a single required input argument of type UpdateEventForwardingRule!. Provide the repository name and rule identifier, plus any fields to change. The mutation returns a non-null EventForwardingRule! object representing the updated rule.

To retrieve the identifier of an existing rule, run the repository() query in the Related section.

Input parameters

Provide the repository name and the rule identifier. Include only the fields to change. To retrieve the rule identifier, run the repository() query in the Related section.

Table: UpdateEventForwardingRule Input Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
eventForwarderIdStringyes Long-Term The unique identifier of the event forwarder.
idStringyes Long-Term The unique identifier for the event forwarding rule.
languageVersionLanguageVersionEnum  Long-Term The version of Human language to use. If non-null, it will be a version known by the current LogScale installation. See LanguageVersionEnum.
queryStringStringyes Long-Term The query string for filtering and mapping the events to forward.
repoNameStringyes Long-Term The name of the repository associated with the event forwarding rule.

Example

Raw
graphql
mutation {
  updateEventForwardingRule( input:
     { repoName: "humio",
       id: "abc123"
       queryString: "@host=localhost",
       eventForwarderId: "def456",
       languageVersion: legacy
    } 
  )
  { 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 {
  updateEventForwardingRule( input:
     { repoName: \"humio\",
       id: \"abc123\"
       queryString: \"@host=localhost\",
       eventForwarderId: \"def456\",
       languageVersion: legacy
    } 
  )
  { 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 {
  updateEventForwardingRule( input:
     { repoName: \"humio\",
       id: \"abc123\"
       queryString: \"@host=localhost\",
       eventForwarderId: \"def456\",
       languageVersion: legacy
    } 
  )
  { 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 { ^
  updateEventForwardingRule( input: ^
     { repoName: \"humio\", ^
       id: \"abc123\" ^
       queryString: \"@host=localhost\", ^
       eventForwarderId: \"def456\", ^
       languageVersion: legacy ^
    }  ^
  ) ^
  { id } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  updateEventForwardingRule( input:
     { repoName: \"humio\",
       id: \"abc123\"
       queryString: \"@host=localhost\",
       eventForwarderId: \"def456\",
       languageVersion: legacy
    } 
  )
  { 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 {
  updateEventForwardingRule( input:
     { repoName: \"humio\",
       id: \"abc123\"
       queryString: \"@host=localhost\",
       eventForwarderId: \"def456\",
       languageVersion: legacy
    } 
  )
  { 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 {
  updateEventForwardingRule( input:
     { repoName: \"humio\",
       id: \"abc123\"
       queryString: \"@host=localhost\",
       eventForwarderId: \"def456\",
       languageVersion: legacy
    } 
  )
  { 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 {
  updateEventForwardingRule( input:
     { repoName: \"humio\",
       id: \"abc123\"
       queryString: \"@host=localhost\",
       eventForwarderId: \"def456\",
       languageVersion: legacy
    } 
  )
  { 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": {
    "updateEventForwardingRule": {
      "id": "abc123"
    }
  }
}

Returned values

The mutation returns the updated EventForwardingRule! object. The object includes the rule's identifier, query string, forwarder reference, and configuration details.

Table: EventForwardingRule Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
createdAtLong  Long-Term The UNIX timestamp of when the event forwarder was created.
eventForwarderIdStringyes Long-Term The unique identifier of the event forwarder.
idStringyes Long-Term The unique identifier for the event forwarding rule.
languageVersionLanguageVersionyes Long-Term The version of the LogScale query language to use. See LanguageVersion.
queryStringStringyes Long-Term The query string for filtering and mapping the events to forward.