The generateParserFromTemplate() GraphQL query is used to generate an unsaved parser from a YAML template.

Syntax

Below is the syntax for generateParserFromTemplate():

graphql
generateParserFromTemplate(
    input: GenerateParserFromTemplateInput!
  ): UnsavedParser!

For the GenerateParserFromTemplateInput input see Given Datatypes, the section below. For indicating which parameters of UnsavedParser you want, see the next section, Returned Datatypes.

Given Datatypes

GenerateParserFromTemplateInput has its one required parameter: yamlTemplate with a datatype YAML

Returned Datatypes

The returned datatype UnsavedParser has its own parameters. Below is a list of them along with their datatypes and a description of each:

Table: UnsavedParser

ParameterTypeRequiredDefaultDescription
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 4, 2024
fieldsToBeRemovedBeforeParsing[string]yes A list of fields that will be removed from the event before it's parsed. These fields aren't included om usage calculation.
fieldsToTag[string]yes A list of fields that are used as tags.
namestringyes The name of the unsaved parser.
scriptstringyes The parser script that is executed for each incoming event.
testCases[ParserTestCase]yes Test cases that can be used to help verify that the parser works as expected. See ParserTestCase.