Skip to content

Configuration Property Parsing Implementation

Configuration Property Parsing Implementation

Section titled “Configuration Property Parsing Implementation”

Configuration Property Parsing in rConfig V8 Pro automatically extracts specific data points from device configuration files using regular expressions. This provides an alternative to SNMP polling for collecting device properties, particularly useful when SNMP is unavailable, disabled, or when specific configuration details aren’t exposed via SNMP. Property extraction happens automatically during device backups, integrating seamlessly with rConfig’s configuration management workflow.

Understanding Configuration Property Parsing

Section titled “Understanding Configuration Property Parsing”

Automated data extraction: Parse configuration files to extract hostnames, software versions, IP addresses, NTP servers, DNS settings, routing protocols, interface details, and any other data present in configurations.

SNMP alternative: Collect device properties when SNMP is disabled, blocked, or unsupported by extracting directly from configuration output.

Configuration-specific data: Access information that SNMP doesn’t expose, such as configured services, ACL details, routing policies, or vendor-specific settings.

Historical tracking: Track changes to extracted properties over time, providing audit trails for configuration elements.

During device backups, rConfig’s parsing engine:

  1. Executes configured commands and captures output
  2. Applies defined regex patterns to command output
  3. Extracts values matching the patterns
  4. Stores extracted values as device properties
  5. Logs property changes for historical tracking

Properties are linked to specific commands, so extraction only occurs when those commands execute during backups.

  • rConfig V8 Pro installation
  • Devices configured and backing up successfully
  • Basic understanding of regular expressions (regex)
  • Sample configuration files for testing

Step 1: Understand Property-Command Relationship

Section titled “Step 1: Understand Property-Command Relationship”

Configuration Properties are linked to specific commands. Before creating properties, identify which commands generate the output you want to parse.

Cisco IOS/IOS-XE:

  • show running-config - Full configuration
  • show version - Software/hardware details
  • show ip interface brief - Interface summary

Juniper JUNOS:

  • show configuration - Full configuration
  • show version - System information
  • show interfaces terse - Interface summary

Aruba/HP:

  • show running-config - Full configuration
  • show version - System details
  • show vlans - VLAN information

Critical point: Properties only extract data when their linked command executes during backups. Verify commands are included in device command groups.

Navigate to Inventory → Configuration Properties in the main navigation to view the management interface. The table lists all defined properties with their linked commands, regex patterns, and active status.

Step 3: Create Your First Configuration Property

Section titled “Step 3: Create Your First Configuration Property”

Click Add Configuration Property and configure:

Configuration:

  • Name: Hostname (descriptive, appears in reports)
  • Description: Device hostname extracted from running configuration
  • Command: Select show running-config (or device equivalent)
  • Regex Pattern: /^hostname\s+(\S+)/m
  • Active: ✓ (enabled)

Click Save.

/^hostname\s+(\S+)/m

Pattern breakdown:

  • / - Regex delimiter (required)
  • ^ - Start of line (with /m flag matches each line start)
  • hostname - Literal text to match
  • \s+ - One or more whitespace characters
  • (\S+) - Capture group: One or more non-whitespace characters (extracted value)
  • /m - Multiline flag (makes ^ and $ match line boundaries)

Matches: hostname router1
Extracts: router1

Before deploying to production, test regex patterns against real configuration data.

  1. From Configuration Properties table, click Test next to your property
  2. Select a device with backed-up configurations
  3. Select the configuration file to test against
  4. Click Config Property Test button
  5. Review results:
    • Whether pattern matched
    • Extracted value(s)
    • Any errors

For complex patterns, use regex101.com:

  1. Copy sample configuration section
  2. Paste into test string field
  3. Enter regex pattern
  4. Set flavor to PCRE (PHP)
  5. Verify matching and capture
  6. Refine until correct

Testing workflow: Always test patterns externally before creating properties in rConfig, then verify using rConfig’s test feature with actual device configurations.

Once property is created and tested:

  1. Navigate to Devices → [Your Device]
  2. Run manual backup (or wait for scheduled backup)
  3. After backup completes, go to Device Details → Properties tab
  4. Extracted property appears with its value and timestamp

Extracted properties appear in the Properties tab of the device view, showing the property name, extracted value, and the timestamp of the last successful extraction.

Step 6: View Properties in Inventory Reports

Section titled “Step 6: View Properties in Inventory Reports”

Configuration-parsed properties integrate with inventory exports:

  1. Navigate to Devices, then click the Inventory Report button (top right)
  2. Generate report
  3. Download CSV/Excel
  4. Configuration properties appear as columns alongside SNMP properties and device fields
/^hostname\s+(\S+)/m

Matches: hostname router1
Extracts: router1

/^version\s+(\S+)/m

Matches: version 15.7
Extracts: 15.7

/^ip domain name\s+(\S+)/m

Matches: ip domain name example.com
Extracts: example.com

/^ntp server\s+(\S+)/m

Matches: ntp server ie.pool.ntp.org
Extracts: ie.pool.ntp.org

Note: Multiple matches extract all NTP servers.

/^ip name-server\s+(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/m

Matches: ip name-server 8.8.8.8
Extracts: 8.8.8.8

/^snmp-server community\s+(\S+)/m

Matches: snmp-server community public RO
Extracts: public

/^logging host\s+(\S+)/m

Matches: logging host 192.168.1.10
Extracts: 192.168.1.10

/^interface Loopback(\d+)/m

Matches: interface Loopback0
Extracts: 0

For full interface name:

/^interface (Loopback\d+)/m

Extracts: Loopback0

/ip address\s+(\d+\.\d+\.\d+\.\d+)/

Matches: ip address 192.168.1.1 255.255.255.0
Extracts: 192.168.1.1

/^\s*network\s+(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/m

Matches: network 10.0.0.0
Extracts: 10.0.0.0

Context: Within BGP configuration sections.

/^router ospf\s+(\d+)/m

Matches: router ospf 100
Extracts: 100

/Processor board ID (\S+)/

Matches: Processor board ID 9FM4W37HHOV
Extracts: 9FM4W37HHOV

/System image file is "([^"]+)"/

Matches: System image file is "bootflash:packages.conf"
Extracts: bootflash:packages.conf

/Configuration register is (\S+)/

Matches: Configuration register is 0x2102
Extracts: 0x2102

/(\d+K bytes of physical memory)/

Matches: 3984840K bytes of physical memory
Extracts: 3984840K bytes of physical memory

/License Level:\s+(\S+)/

Matches: License Level: ax
Extracts: ax

/^enable secret 5 (.+)$/m

Matches: enable secret 5 $1$PYMP$ShFY8kvekfirjMFGsPnRZ0
Extracts: $1$PYMP$ShFY8kvekfirjMFGsPnRZ0

/^crypto pki trustpoint\s+(\S+)/m

Matches: crypto pki trustpoint myCA
Extracts: myCA

Extract values requiring context across multiple lines:

/^interface GigabitEthernet0\/0[\s\S]*?ip address\s+(\d+\.\d+\.\d+\.\d+)/m

Purpose: Extract IP address specifically from GigabitEthernet0/0 interface block.

Explanation: [\s\S]*? matches any characters (including newlines) non-greedily until finding the IP address pattern within that interface block.

Handle configurations where elements may or may not be present:

/^ntp server\s+(\S+)(?:\s+prefer)?/m

Purpose: Extract NTP server whether or not prefer keyword is present.

Explanation: (?:\s+prefer)? is a non-capturing optional group matching the prefer keyword if present.

For clarity in complex patterns:

/^interface\s+(?<interface>\S+)[\s\S]*?ip address\s+(?<ip>\d+\.\d+\.\d+\.\d+)/m

Purpose: Extract both interface name and IP address with clear naming.

Note: Named groups improve readability but rConfig extracts the first captured group by default.

Begin with basic single-line extractions. Test thoroughly before adding complexity. A working simple pattern is better than a broken complex one.

Never deploy untested patterns. Use both regex101.com and rConfig’s test feature against real configurations before enabling properties.

Use clear property names and detailed descriptions explaining what’s extracted and why.

Good: NTP Servers with description Extracts all configured NTP server addresses from running configuration
Bad: regex1 with no description

Different vendors use different syntax for the same concept:

Cisco: ntp server 1.1.1.1
Juniper: set system ntp server 1.1.1.1

Create vendor-specific properties or flexible regex patterns accommodating variations.

Some properties (NTP servers, DNS servers, interfaces) naturally return multiple values. This is expected and supported—rConfig stores all matches.

Verify your property links to commands actually executing on target devices. A perfect regex pattern linked to a non-existent command extracts nothing.

Review logs periodically to verify properties extract successfully across your device population. Look for patterns of failures indicating regex issues or command problems.

Avoid overly complex regex causing performance issues. If a pattern takes >100ms to execute, simplify it or break into multiple properties.

Symptoms: Property shows in device details but has no value or NULL value.

Diagnosis and resolution:

  1. Regex doesn’t match configuration format

    • Test regex against actual config using rConfig test feature or regex101.com
    • Verify pattern matches your device’s specific output format
    • Check for vendor variations in syntax
  2. Property linked to wrong command

    • Verify command assigned to property matches command actually executing
    • Check device’s command group includes the required command
    • Review backup logs to confirm command executed
  3. Command not executing during backup

    • Verify command exists in device’s command group
    • Check command is enabled and not disabled
    • Review backup logs for command execution
  4. Regex syntax error

    • Validate syntax in regex101.com with PCRE (PHP) flavor
    • Check for unescaped special characters
    • Verify delimiters and flags are correct
  5. Missing multiline flag

    • Add /m flag to pattern: /pattern/m
    • Required when using ^ or $ anchors to match line boundaries

Debugging steps:

Terminal window
# View recent parsing logs
tail -f /var/www/html/rconfig8/current/storage/logs/laravel.log | grep -i "property\|parsing"
# List stored configuration files
ls -la /var/www/html/rconfig8/current/storage/app/rconfig/data/

Symptoms: Property extracts data but it’s incorrect, incomplete, or includes unwanted text.

Possible causes and resolutions:

  1. Regex too broad

    • Add anchors: ^ for line start, $ for line end
    • Make matching more specific with additional context
    • Example: Change /hostname (\S+)/ to /^hostname\s+(\S+)/m
  2. Capture group positioning wrong

    • Verify parentheses capture only desired value
    • Check for multiple capture groups (rConfig uses first)
    • Test in regex101.com to see what’s captured
  3. Pattern matches more than intended

    • Add more specific context before/after capture
    • Use word boundaries: \b
    • Add negative lookaheads/lookbehinds for exclusions

Example fix:

# Too broad - matches comments too
/hostname (\S+)/
# Better - anchored to line start, requires whitespace
/^hostname\s+(\S+)/m

Symptoms: Property extracts too many values, including unintended matches.

Resolution:

  1. Make pattern more specific:

    # Too broad
    /server (\S+)/
    # More specific - only NTP servers
    /^ntp server\s+(\S+)/m
  2. Add context requirements:

    # Only match within specific section
    /^router bgp \d+[\s\S]*?network\s+(\d+\.\d+\.\d+\.\d+)/m
  3. Use negative lookbehind/lookahead:

    # Match IP but not if followed by "secondary"
    /ip address\s+(\d+\.\d+\.\d+\.\d+)(?!\s+\d+\.\d+\.\d+\.\d+\s+secondary)/

Symptoms: Backups slow down significantly after adding properties, or timeouts occur.

Possible causes and resolutions:

  1. Overly complex regex with catastrophic backtracking

    • Simplify pattern
    • Avoid nested quantifiers: (a+)+
    • Use possessive quantifiers: ++ or atomic groups: (?>...)
    • Test pattern performance in regex101.com debugger
  2. Too many properties per command

    • Limit to 10-15 properties per command
    • Combine related extractions into fewer, more efficient patterns
    • Prioritize essential properties
  3. Very large configuration files

    • Consider extracting only from specific sections
    • Use more targeted patterns rather than .* or [\s\S]*

Access extracted properties for specific devices:

  1. Navigate to Devices → [Device Name]
  2. Click Properties tab
  3. View all SNMP-polled and configuration-parsed properties with values and timestamps

Manage all property definitions:

  1. Navigate to Inventory → Configuration Properties
  2. View, edit, delete, or test properties
  3. Enable/disable properties without deleting
  4. Clone properties for creating variations

The management table provides edit, delete, test, enable/disable, and clone actions for each property definition.

Configuration properties appear in inventory exports alongside:

  • Device core fields (hostname, IP, vendor, model)
  • SNMP-polled properties
  • Custom fields

Export workflow:

  1. Navigate to Devices → Inventory Report
  2. Select devices or groups
  3. Generate and download report
  4. All properties appear as columns

All property extraction events are logged:

  1. Navigate to System Settings → Monitoring & Debugging → Application Logs
  2. Filter by device name or property name
  3. Review extraction success/failure and value changes
  4. Export logs for analysis

Goal: Verify all devices use approved NTP servers.

Implementation:

  • Property Name: NTP Servers
  • Regex: /^ntp server\s+(\S+)/m
  • Workflow: Export inventory, filter for devices with non-approved NTP servers, generate remediation list

Goal: Identify devices running outdated software.

Implementation:

  • Property Name: Software Version
  • Regex: /^version\s+(\S+)/m
  • Workflow: Export inventory, identify devices below minimum version, prioritize upgrades

Goal: Ensure all devices use corporate DNS servers.

Implementation:

  • Property Name: DNS Name Servers
  • Regex: /^ip name-server\s+(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/m
  • Workflow: Verify all devices list approved DNS servers, identify non-compliant configurations

Goal: Track which devices have enable secrets configured.

Implementation:

  • Property Name: Enable Secret Configured
  • Regex: /^enable secret/m
  • Workflow: Identify devices missing enable secrets, ensure password policies enforced
PatternMeaning
^Start of line (with /m flag)
$End of line (with /m flag)
\sWhitespace character
\SNon-whitespace character
\dDigit (0-9)
+One or more of preceding
*Zero or more of preceding
?Zero or one of preceding (optional)
()Capture group (extracts value)
(?:)Non-capturing group
.Any character except newline
[\s\S]Any character including newline
/mMultiline flag
/iCase-insensitive flag
  1. Identify target data in sample configuration
  2. Write regex pattern
  3. Test in regex101.com (PCRE/PHP flavor)
  4. Create property in rConfig
  5. Test using rConfig test feature
  6. Run backup on test device
  7. Verify extraction in device properties
  8. Deploy to production devices