The testParserV2() GraphQL mutation is used to test a parser on some test events in LogScale. If the parser fails to run, an error is returned. Otherwise, a list of results, one for each test event, is returned.

For more information on parsers, see the Parsing Data documentation page.

Syntax

Below is the syntax for the testParserV2() mutation field:

graphql
testParserV2(
      input: ParserTestRunInput!
   ): ParserTestRunOutput!

Given Datatypes

For the given datatype, ParserTestRunInput, there are several parameters that may be given. Below is a list of them along with their datatypes and a description of each:

Table: ParserTestRunInput

ParameterTypeRequired[a]DefaultDescription
repositoryNameRepoOrViewNameyes The name of the repository in which the parser is located. This is part of the test output in the `#repo` field in each parsed event. The RepoOrViewName is a scalar.
parserNamestringyes The name of the parser. This is part of the test output in the `#type` field in each parsed event.
scriptstringyes The parser script that is executed for every incoming event.
fieldsToTag[string]yes The fields that are used as tags.
fieldsToBeRemovedBeforeParsing[string]yes A list of fields that will be removed from the event before it's parsed. These fields will not be included when calculating usage.
testCases[ParserTestCaseInput]yes The test cases to run the parsing script against.
languageVersionLanguageVersionInputType = {name: 'legacy'}yes A specific language version.

[a] Some arguments may be required, as indicated in this column. For some fields, this column indicates that a result will always be returned for it.


Returned Datatypes

The returned datatype, ParserTestRunOutput is the output of running all the parser test cases, and a union of two other datatypes:

graphql
ParserTestRunOutput =
      ParserTestRunCompleted | ParserTestRunAborted

Table: ParserTestRunCompleted

ParameterTypeRequired[a]DefaultDescription
results[ParserTestCaseResult]yes The results from running each test case.

[a] Some arguments may be required, as indicated in this column. For some fields, this column indicates that a result will always be returned for it.


Table: ParserTestRunAborted

ParameterTypeRequired[a]DefaultDescription
errorMessagestringyes The error message returned when a parser test is run aborted.

[a] Some arguments may be required, as indicated in this column. For some fields, this column indicates that a result will always be returned for it.