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 Method | Deployable | How it extracts fields |
|---|---|---|
| Parse With Rule | Yes | Each 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 Json | Yes | Each rule names a dotted path to a value in the JSON document in the line. Text before the first { is ignored. |
| Parse With Nested Json | Yes | The same as Parse With Json, for JSON with nested objects. |
| Parse With Key Value | Yes | The 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
- Open Custom Parsers and select the + button (Add Custom Parser).
- 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.
- Choose the Parse Method.
- Paste a real line into Sample. For the JSON methods this lists the keys it finds, so you can pick them.
- 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. - For Parse With Key Value, set the Key Delimiter and Pair Delimiter.
- 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. - Optionally select Apply Exception, which trims each extracted value and collapses repeated spaces.
- Select Test. The result lists each field and the value extracted, or says that no fields matched.
- Select Save.
Reset rules clears the rules.
Deploy a parser
A saved parser does nothing until it is deployed.
- 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.
- 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.