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

ParameterTypeRequired[a]DefaultDescription
namestringyes The name of the unsaved parser.
scriptstringyes The parser script that is executed for every incoming event.
fieldsToTag[string]yes List of 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 aren't included om usage calculation.
testCases[ParserTestCase]yes Test cases that can be used to help verify that the parser works as expected. See Dashboard.

[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.