How to configure diff exclusions in rConfig V8 Core
Every configuration backup captures a snapshot in time, but not everything in that snapshot matters for change tracking. Timestamps change with every backup, uptime counters increment constantly, session IDs are ephemeral, and certificate renewal dates shift. After reading this page you can configure Compare Options and write regex-based diff exclusions that filter this noise out of your configuration diffs.
When to use this
Section titled “When to use this”Use diff exclusions when your configuration diffs show changes every backup cycle even though nothing meaningful changed. This is common on devices that report uptime, session IDs, packet counters, or certificate data in their running configuration. Set up exclusions once and every future diff benefits.
Prerequisites
Section titled “Prerequisites”- At least one device with configuration backups running, so you have diffs to compare against
- Access to Compare Options under Inventory → Commands
- A sample diff showing the noise you want to exclude, so you can identify the pattern to match
Why diff noise matters
Section titled “Why diff noise matters”You run daily backups of your core routers. Yesterday’s config and today’s config show 47 differences, but when you review the diff:
- 20 differences are timestamp updates
- 15 are uptime counter changes
- 8 are interface packet counters
- 3 are session IDs
- 1 is an actual ACL modification
You spent ten minutes finding the one real change buried in 46 false positives. Multiply this across hundreds of devices and diff noise becomes a serious operational burden. Diff exclusions remove that waste by hiding the dynamic content so only real changes surface.
Compare Options
Section titled “Compare Options”rConfig V8 Core stores a single set of comparison options plus a global exclusion file that are applied to every config comparison. Two settings work together: the comparison options below control how the diff engine behaves, and the exclusion file (covered in the walkthrough) controls which content is ignored.
| Option | Purpose | Example use case |
|---|---|---|
| Compare Exclusions | Exclude specific lines or patterns using regex | Ignore ! Last configuration change at 12:34:56 timestamps |
| Compare Context | Show N lines before and after each difference | Show 3 lines of context around changes for readability |
| Length Limit | Limit the number of characters compared | Cap comparison of very large command output |
| Ignore Case | Case-insensitive comparison | Treat Router and router as identical |
| Ignore Line Ending | Ignore CR/LF differences | Handle configs from Windows, Linux, and Unix systems |
| Ignore Whitespace | Ignore spaces, tabs, and indentation | Ignore formatting differences, focus on content |
Configuring diff exclusions
Section titled “Configuring diff exclusions”Diff exclusions use regex patterns to identify content that should be ignored during comparison. Follow these steps to open Compare Options and write your first exclusion file.
-
Navigate to Inventory → Commands and click Compare Options. Alternatively, from a stored diff (the Config Changes panel on a config), click Open Compare Options.
-
Open the Compare Exclusions field. This is where the exclusion file content is entered.
-
Start the file with a description line, a method block, and your regex patterns, using this structure:
// Description of what this exclusion does#[global]/regex pattern one//regex pattern two/// Description of command-specific exclusion#[command-name]/command-specific pattern/- A description line (
//followed by text) explains what the exclusion does. - A method block (
#[method-name]) defines the scope. The first block must be#[global]. - Regex patterns sit one per line, including delimiters (
/pattern/) and any flags (/pattern/i,/pattern/ms).
- A description line (
-
Add a
#[global]block first for content that is dynamic across every device, such as timestamps and session IDs. This block applies to all command output on all devices.// Exclude all timestamp variations#[global]/^! Last configuration change at.*$//^! NVRAM config last updated at.*$//^Building configuration.*$/ -
Add
#[command-name]blocks below it for noise that is specific to one command. Match the command name to the Commands table exactly: if the command is stored asshow run, use#[show run].// Exclude uptime from show version#[show version]/^.*uptime is.*$//^System restarted at.*$//^System image file is.*$/ -
Validate each pattern at regex101.com before saving: set the flavor to PCRE (PHP), paste a sample of the command output, and confirm the pattern matches only what you intend.
-
Save the Compare Options. The exclusions apply to every future config comparison.
Single-line exclusion patterns
Section titled “Single-line exclusion patterns”Single-line patterns are processed line by line. They are ideal for filtering individual lines of dynamic content.
Session information
Section titled “Session information”// Exclude session details from show run#[show run]/^! Session ID:.*$//^Current configuration : \d+ bytes$/Interface counters
Section titled “Interface counters”// Exclude packet and error counters#[show interfaces]/^\s+\d+ packets input, \d+ bytes.*$//^\s+\d+ packets output, \d+ bytes.*$//^\s+\d+ input errors.*$/Multiline exclusion patterns
Section titled “Multiline exclusion patterns”Multiline patterns handle content spanning multiple lines, such as certificate blocks and configuration sections. They require special regex flags.
Multiline regex flags
Section titled “Multiline regex flags”s(dotall): allows.to match newline characters. Essential for patterns crossing line boundaries.m(multiline): makes^and$match the start and end of any line, not just the whole string.ms(combined): most multiline exclusions need both.
Certificate block exclusions
Section titled “Certificate block exclusions”Certificates span many lines and change when renewed. Use non-greedy matching (.*?) to stop at the first closing tag.
// Exclude certificate text from show run#[show run]/^crypto pki certificate.*?-----END CERTIFICATE-----"$/ms
// Exclude public keys#[show run]/^ssh-rsa AAAA.*?==.*$/msConfiguration block exclusions
Section titled “Configuration block exclusions”// Exclude interface configuration blocks#[show run]/^interface .*?^!/msPattern explanation for /^interface .*?^!/ms:
^interfacematches the start of a line matching “interface”.*?is a non-greedy match of any content (including newlines via thesflag)^!stops at a line starting with!(Cisco section delimiter)/msapplies the multiline and dotall flags
Complete exclusion example
Section titled “Complete exclusion example”A practical exclusion configuration for Cisco IOS devices:
// Global exclusions for all commands#[global]/^! Last configuration change at.*$//^! NVRAM config last updated at.*$//^ntp clock-period \d+$//^.*uptime is.*$/
// Show run specific exclusions#[show run]/^Building configuration.*$//^Current configuration : \d+ bytes$//^crypto pki certificate.*?-----END CERTIFICATE-----"$/ms/^interface .*?^!/msBest practices
Section titled “Best practices”- Start broad, then refine. Begin with global exclusions for universal noise such as timestamps, then add command-specific exclusions as you identify patterns unique to certain commands.
- Test patterns before deployment. Validate every pattern at regex101.com with the PCRE (PHP) flavor against a real sample of command output.
- Use non-greedy matching for multiline. Always use
.*?rather than.*in multiline patterns, or a single pattern can swallow multiple config blocks at once. - Be specific, not overly broad.
/^! Last configuration change at.*$/matches only that timestamp line, whereas/interface/matches any line containing the word and will hide real changes.
Why isn’t my exclusion working?
Section titled “Why isn’t my exclusion working?”- Verify the command name matches the Commands table exactly (case-sensitive).
- Check the regex syntax: delimiters present (
/pattern/), correct flags (/pattern/ms), special characters escaped (\.). - Test the pattern in isolation on regex101.com with the PCRE (PHP) flavor.
- Confirm
#[global]is the first block.
If important changes are being hidden, the pattern is too broad. Add anchors and context, for example use /^interface Loopback\d+$/m instead of /interface/. If a multiline pattern is not matching, add the s flag so . matches newlines, use non-greedy .*?, and ensure ^ and $ have the m flag.
Quick reference
Section titled “Quick reference”| Flag | Name | Purpose | Example |
|---|---|---|---|
s | Dotall | . matches newlines | /pattern.*content/s |
m | Multiline | ^ and $ match line boundaries | /^interface.*$/m |
i | Case-insensitive | Ignore case | /router/i |
ms | Combined | Both multiline and dotall | /^block.*?^!/ms |
Never use the g flag in rConfig exclusions.
What’s next
Section titled “What’s next”- Config Diffs and Versioning → for the main diff and versioning overview
- Manual Config Compare → to compare any two configs
- Config Search → to find configs across your estate