Skip to main content

Custom parsers

This page explains how to create a custom parser for syslog messages that have no built-in parser, test it against a sample line, deploy it, and use it on a data source.

Role needed: a user with the Admin or Super Admin account type. A user with a custom role needs Settings access and, under Collection & Automation, Log Onboarding with Read to see parsers, Set to create, change, deploy or undeploy a parser, and Delete to remove one.

Parse methods​

Select Settings, then Custom Parsers under Collection & Automation. The deployable methods are:

Parse MethodDeployableHow it extracts fields
Parse With RuleYesEach rule is a regular expression run against the whole line. The first capture group, or the whole match if there is no group, becomes the field's value.
Parse With JsonYesEach rule names a dotted path to a value in the JSON document in the line. Text before the first { is ignored.
Parse With Nested JsonYesThe same as Parse With Json, for JSON with nested objects.
Parse With Key ValueYesThe line is split into pairs by the Pair Delimiter and each pair into a key and value by the Key Delimiter. Rules rename keys to fields; with no rules every key is kept as it is.

Create a parser​

  1. Open Custom Parsers and select the + button (Add Custom Parser).
  2. Enter the Product, the name of the parser. Characters other than letters, digits, hyphen and underscore are replaced by an underscore, and the name must be unique.
  3. Choose the Parse Method.
  4. Paste a real line into Sample. For the JSON methods this lists the keys it finds, so you can pick them.
  5. Add the rules. Enter the Pattern (a regular expression, or for the JSON methods a dotted path such as user.name), choose the Field it fills from the picker or type a field name, and select Add. A row shows a tick when it matches the pasted sample and a cross when it does not.
  6. For Parse With Key Value, set the Key Delimiter and Pair Delimiter.
  7. Optionally set Mapping. Static translates raw values to labels from pairs you enter; File loads the pairs from a JSON file of the form {"raw": "label"}. The mapping applies to every rule's output.
  8. Optionally select Apply Exception, which trims each extracted value and collapses repeated spaces.
  9. Select Test. The result lists each field and the value extracted, or says that no fields matched.
  10. Select Save.

Reset rules clears the rules.

Deploy a parser​

A saved parser does nothing until it is deployed.

  1. In the list, select Deploy on the parser. A parser must have at least one rule, and the patterns of a Parse With Rule parser must be valid regular expressions.
  2. The status changes from Not Deployed to Deployed.

Select Undeploy to stop using it. The list shows each parser's status: Deployed, Not Deployed or Not Deployable Yet.

Use a deployed parser​

Open the syslog source and, under Vendor list, choose Custom Plugins, then your parser as the Product. You can also add it under Parser fallback. See How events are parsed.

Next steps​