API Stability Long-Term

The createIngestListenerV3() GraphQL mutation may be used to create an ingest listener.

To update an ingest listener, you would use the updateIngestListenerV3() mutation. Use deleteIngestListener() to delete one.

Hide Query Example

Show Ingest Listeners Query

For more information on ingest listeners, see the Ingest Listeners documentation page. You may also want to look at the Ingesting Data page for related information.

Syntax

graphql
createIngestListenerV3(
      input: CreateIngestListenerV3Input!
   ): IngestListener!

Example

Below is an example of how this mutation field might be used:

Raw
graphql
mutation {
  createIngestListenerV3(input:
       { repositoryName: "humio",
         port: 8080, protocol: TCP,
         name: "listen-up",
         bindInterface: "12.127.18.88",
         parser: "kv", charset: "UTF-8" } )
  { 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 {
  createIngestListenerV3(input:
       { repositoryName: \"humio\",
         port: 8080, protocol: TCP,
         name: \"listen-up\",
         bindInterface: \"12.127.18.88\",
         parser: \"kv\", charset: \"UTF-8\" } )
  { 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 {
  createIngestListenerV3(input:
       { repositoryName: \"humio\",
         port: 8080, protocol: TCP,
         name: \"listen-up\",
         bindInterface: \"12.127.18.88\",
         parser: \"kv\", charset: \"UTF-8\" } )
  { 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 { ^
  createIngestListenerV3(input: ^
       { repositoryName: \"humio\", ^
         port: 8080, protocol: TCP, ^
         name: \"listen-up\", ^
         bindInterface: \"12.127.18.88\", ^
         parser: \"kv\", charset: \"UTF-8\" } ) ^
  { id } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  createIngestListenerV3(input:
       { repositoryName: \"humio\",
         port: 8080, protocol: TCP,
         name: \"listen-up\",
         bindInterface: \"12.127.18.88\",
         parser: \"kv\", charset: \"UTF-8\" } )
  { 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 {
  createIngestListenerV3(input:
       { repositoryName: \"humio\",
         port: 8080, protocol: TCP,
         name: \"listen-up\",
         bindInterface: \"12.127.18.88\",
         parser: \"kv\", charset: \"UTF-8\" } )
  { 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 {
  createIngestListenerV3(input:
       { repositoryName: \"humio\",
         port: 8080, protocol: TCP,
         name: \"listen-up\",
         bindInterface: \"12.127.18.88\",
         parser: \"kv\", charset: \"UTF-8\" } )
  { 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 {
  createIngestListenerV3(input:
       { repositoryName: \"humio\",
         port: 8080, protocol: TCP,
         name: \"listen-up\",
         bindInterface: \"12.127.18.88\",
         parser: \"kv\", charset: \"UTF-8\" } )
  { 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();

Given Datatype

For this input datatype, you would provide the name of the repository associated with the listener, the parser used, the IP address, port, and other connection elements. These are listed and explained, along with other parameters, in the table below:

Table: CreateIngestListenerV3Input

ParameterTypeRequiredDefaultStabilityDescription
Some arguments may be required, as indicated in the Required column. For return datatypes, this indicates that you must specify which fields you want returned in the results.
Table last updated: Sep 17, 2024
bindInterfacestringyes Long-TermThe IP address that to which the ingest listener will bind.
charsetstringyes Long-TermThe charset used to decode the event stream.
namestringyes Long-TermName of the ingest listener.
parserIdstringyes Long-TermThe identifier of the parser to assign to the ingest listener.
portintegeryes Long-TermThe TCP/UDP port the ingest listener will listen on.
protocolIngestListenerProtocolyes Long-TermThe kind of listener. See IngestListenerProtocol.
repositoryNamestringyes Long-TermName of the repository.
vHostinteger  Long-TermThe vHost name for the ingest listener.

Returned Datatype

This datatype can return the repository associated with the ingest listener, the parser used, the network protocol through which data is sent (e.g., TCP), and other related information. See the table below for more:

Table: IngestListener

ParameterTypeRequiredDefaultStabilityDescription
Some arguments may be required, as indicated in the Required column. For return datatypes, this indicates that you must specify which fields you want returned in the results.
Table last updated: Sep 25, 2024
bindInterfacestringyes Long-TermThe ip address this listener will bind to. By default (leaving this field empty) it will bind to 0.0.0.0 - all interfaces. Using this field it is also possible to specify the address to bind to. In a cluster setup it is also possible to specify if only one machine should open a socket - The vhost field is used for that.
charsetstringyes Long-TermThe character set used to decode the event stream. Available character sets depend on the JVM running the LogScale instance. Names and aliases can be found at http://www.iana.org/assignments/character-sets/character-sets.xhtml
idstringyes Long-TermThe unique identifier for the ingest listener.
namestringyes Long-TermThe name of the ingest listener.
parserParser  Long-TermThe parser configured to parse data for the listener. It returns null if the parser has been removed since the listener was created. See Parser.
portintegeryes Long-TermThe TCP/UDP port on which to listen.
protocolIngestListenerProtocolyes Long-TermThe network protocol data is sent through. See IngestListenerProtocol.
repositoryRepositoryyes Long-TermThe repository associated with the ingest listener. See Repository.
vHostinteger  Long-TermSpecify which host should open the socket. By default this field is empty and all hosts will open a socket. This field can be used to select only one host to open the socket.