Collector parser is used to group variables by certain keywords, and then parse those variable bed on the grouping results.
Collector parser is designed for the following 3 scenarios:
▪ VRRP/IS-IS configuration
▪Configuration files in JSON format.
▪Grouping log file during parsing process.
To define a collector variable, you need two steps:
1.Define the ID Line, which will be used as the keyword to identify recurring groups. If you want to define an optional Parent Line, please refer to Parent Line for more details.
2.Define 0~N Variable Line Patterns to parse variables inside each recurring group that has been identified by ID Line Pattern.
The parsed result of a collector parser is in a tabular shape. The variables defined in ID line patterns, variable line patterns, and parent line patterns (optional) will be formed as table columns.
Take Configuration Scenario of VRRP as an example. You can define a collector parser to parse VRRF information.
1.Retrieve sample text, for example:
vrrp 1 description parser_test
vrrp 1 ip 10.1.1.254
vrrp 1 ip 10.1.1.199 secondary
vrrp 1 timers advertise 100
2.Select a parser type by clicking Add Collector and click on the input box of the target ID Line.
3.Define ID Line Pattern: anchor the paragraph identifier to identify recurring keywords.
1)Select keyword and click the arrow ( ) to duplicate it as an ID Line.
2)Define an Integer variable by replacing 1 with $int:num
4.Define Variable Line Pattern: parsing variables inside each recurring paragraph that has been identified by ID Line Pattern.
1)Select vrrp 1 description parser_test in the Sample area and click the arrow ( ) to duplicate it as Variable Line 1.
2)In the Variable Line 1 field, replace parser_test with $desc
3)Select vrrp 1 timers advertise 100 in the Sample area, and click the arrow ( ) to duplicate it as Variable Line 2.
4)In the Variable Line 2 field, replace advertise 100 with $mstring:timer.
5.Preview the parsed result of sample text, and then click OK to save the paragraph parser.