The createParserFromTemplate() GraphQL mutation may be used to create a parser from a yaml specification.

For more information on creating a parser, see the Creating a Parser documentation page. You may also want to look at the Parsing Data page for related information.

Syntax

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

graphql
createParserFromTemplate(
      input: CreateParserFromTemplateInput!
   ): Parser!

Given Datatypes

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

Table: CreateParserFromTemplateInput

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: Sep 17, 2024
namestringyes Name of the parser.
viewNameRepoOrViewNameyes Name of the view of the parser. RepoOrViewName is a scalar.
yamlTemplateyamlyes The YAML specification of the parser.

Returned Datatypes

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

Table: Parser

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.
assetTypeAssetTypeyes The type of asset. See AssetType. This is deprecated and will be removed in LogScale 1.142.
descriptionstring  A description of the parser.
displayNamestringyes The full name of the parser, including package information if part of an application.
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.
fieldsToTag[string]yes The fields that are used as tags.
idstringyes The unique identifier of the parser.
isBuiltInbooleanyes True if the parser is one of LogScale's built-in parsers.
languageVersionLanguageVersionyes The language version used by the parser. See LanguageVersion.
namestringyes The name of the parser.
scriptstringyes The parser script that is executed for every incoming event.
sourceCodestringyes The source code of the parser. This is deprecated and will be replaced with script starting in version 1.142.
tagFields[string]yes The fields to use as tags. This is deprecated and will be replaced with fieldsToTag starting in version 1.142.
testCases[ParserTestCase]yes Test cases that can be used to help verify that the parser works as expected. See ParserTestCase.
testData[string]yes Saved test data (e.g., log lines) that you can use to test the parser. This is deprecated and will be replaced with testCases starting with version 1.142.
packagePackageInstallation  The package associated with the parser, if any. See PackageInstallation.
packageIdVersionedPackageSpecifier  The identifier of the package used, if one. VersionedPackageSpecifier is a scalar.
yamlTemplateyamlyes A template that can be used to recreate the parser.