API Stability |
Deprecated
|
The testParser() 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.
This is deprecated and will be removed in version 1.142. Use instead testParserV2().
For more information on parsers, see the Parsing Data documentation page.
Syntax
Below is the syntax for the testParser() mutation field:
testParser(
input: TestParserInputV2!
): TestParserResultV2!
Below is an example of how this mutation field might be used:
mutation {
testParser(input:
{ repositoryName: "humio",
parserId: "123abc",
parserName: "my-parser",
parserScript: "kvParse()",
testData: [{
event: {rawString: "key=value"},
outputAssertions: [{outputEventIndex: 0,
assertions: { fieldsHaveValues:
[{fieldName: "key", expectedValue: "value"}]
} } ],
}],
} )
{ ... on ParserTestRunCompleted {
results {
outputEvents { fields { fieldName, value } },
outputFailures {
outputEventIndex,
failures {
parsingErrors,
assertionFailuresOnFields {
... on FieldUnexpectedlyPresent { fieldName, actualValue }
... on Field adUnexpectedValue { fieldName, expectedValue, actualValue }
... on FieldHadConflictingAssertions { fieldName }
... on AssertionOnFieldWasOrphaned { fieldName }
}
} } } }
... on ParserTestRunAborted { errorMessage }
}
Given Datatypes
For TestParserInputV2, there are a few parameters that may be given. Below is a list of them along with a description of each:
Table: TestParserInputV2
Parameter | Type | Required | Default | Stability | Description |
---|---|---|---|---|---|
Some arguments may be required, as indicated in the Required column. For some fields, this column indicates that a result will always be returned for this column. | |||||
Table last updated: Sep 20, 2024 | |||||
parserId | string | yes | Deprecated | The unique identifier of the parser. | |
parserName | string | yes | Deprecated | The name of the parser. | |
parserScript | string | yes | Deprecated | The parser script to be tested. | |
repositoryName | string | yes | Deprecated | The name of the repository in which the parser is located. | |
testData | [string] | yes | Deprecated | The events on which to test the parser. |
Returned Datatypes
The returned datatype, TestParserResultV2 is a union between two other datatypes: TestParserSuccessResultV2 and TestParserErrorResult. The parameters for those are listed in the tables below. See the example given above for a better understanding on how to enter these parameters.
Table: TestParserSuccessResultV2
Parameter | Type | Required | Default | Stability | Description |
---|---|---|---|---|---|
Some arguments may be required, as indicated in the Required column. For some fields, this column indicates that a result will always be returned for this column. | |||||
Table last updated: Mar 27, 2025 | |||||
results | [ParseEventResult ] | yes | Deprecated | The results of parsing test events. See ParseEventResult . This datatype and field are deprecated. They will be removed at the earliest in version 1.183. |
Table: TestParserErrorResult
Parameter | Type | Required | Default | Stability | Description |
---|---|---|---|---|---|
Some arguments may be required, as indicated in the Required column. For some fields, this column indicates that a result will always be returned for this column. | |||||
Table last updated: Oct 3, 2024 | |||||
errorMessage | string | yes | Deprecated | An error message while running a parser. No events were parsed. This datatype and field are deprecated. They will be removed at the earliest in version 1.183. |