Update docs with exclude patterns
This commit is contained in:
@ -34,6 +34,14 @@ types:
|
|||||||
- show version
|
- show version
|
||||||
- show inventory
|
- show inventory
|
||||||
- show running-config
|
- show running-config
|
||||||
|
|
||||||
|
routeros:
|
||||||
|
commands:
|
||||||
|
- system package print detail without-paging
|
||||||
|
- / export terse
|
||||||
|
exclude:
|
||||||
|
- "^# ....-..-.. ..:..:.. by RouterOS" # Filter timestamp headers
|
||||||
|
- "^# .../../.... ..:..:.. by RouterOS" # Alternative date format
|
||||||
```
|
```
|
||||||
|
|
||||||
**Main configuration** (`config.yaml`):
|
**Main configuration** (`config.yaml`):
|
||||||
@ -64,6 +72,7 @@ devices:
|
|||||||
#### Types Section
|
#### Types Section
|
||||||
- **`<type-name>`**: Device type name (e.g., `srlinux`, `eos`)
|
- **`<type-name>`**: Device type name (e.g., `srlinux`, `eos`)
|
||||||
- **`commands`**: Array of CLI commands to execute
|
- **`commands`**: Array of CLI commands to execute
|
||||||
|
- **`exclude`** (optional): Array of regex patterns to filter out unwanted lines from output
|
||||||
|
|
||||||
#### Devices Section
|
#### Devices Section
|
||||||
- **`<hostname>`**: Device hostname (used for SSH config lookup and output filename)
|
- **`<hostname>`**: Device hostname (used for SSH config lookup and output filename)
|
||||||
@ -85,6 +94,43 @@ ipng-router-backup --yaml "*.yaml"
|
|||||||
ipng-router-backup --yaml "config/*.yaml"
|
ipng-router-backup --yaml "config/*.yaml"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Output Filtering
|
||||||
|
|
||||||
|
The tool supports filtering unwanted lines from command output using regular expressions in the `exclude` field of device types.
|
||||||
|
|
||||||
|
### How Exclude Patterns Work
|
||||||
|
|
||||||
|
- **Regex matching**: Each line of command output is tested against all exclude patterns
|
||||||
|
- **Line removal**: Lines matching any pattern are completely removed from the output file
|
||||||
|
- **Per-device type**: Exclude patterns are defined at the device type level and apply to all devices of that type
|
||||||
|
|
||||||
|
### Common Use Cases
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
types:
|
||||||
|
routeros:
|
||||||
|
commands:
|
||||||
|
- / export terse
|
||||||
|
exclude:
|
||||||
|
- "^# ....-..-.. ..:..:.. by RouterOS" # Remove timestamp headers
|
||||||
|
- "^# .../../.... ..:..:.. by RouterOS" # Alternative date format
|
||||||
|
|
||||||
|
cisco-ios:
|
||||||
|
commands:
|
||||||
|
- show running-config
|
||||||
|
exclude:
|
||||||
|
- "^Building configuration" # Remove config build messages
|
||||||
|
- "^Current configuration" # Remove current config headers
|
||||||
|
- "^!" # Remove comment lines
|
||||||
|
|
||||||
|
debug-device:
|
||||||
|
commands:
|
||||||
|
- show logs
|
||||||
|
exclude:
|
||||||
|
- "^DEBUG:" # Filter debug messages
|
||||||
|
- "^TRACE:" # Filter trace messages
|
||||||
|
```
|
||||||
|
|
||||||
## Command Line Usage
|
## Command Line Usage
|
||||||
|
|
||||||
### Required Flags
|
### Required Flags
|
||||||
|
@ -48,6 +48,11 @@ types:
|
|||||||
commands:
|
commands:
|
||||||
- show version
|
- show version
|
||||||
- show platform linecard
|
- show platform linecard
|
||||||
|
routeros:
|
||||||
|
commands:
|
||||||
|
- / export terse
|
||||||
|
exclude:
|
||||||
|
- "^# ....-..-.. ..:..:.. by RouterOS"
|
||||||
.EE
|
.EE
|
||||||
.SS devices
|
.SS devices
|
||||||
Define individual devices:
|
Define individual devices:
|
||||||
@ -70,6 +75,8 @@ Default SSH keys (~/.ssh/id_rsa, ~/.ssh/id_ed25519, ~/.ssh/id_ecdsa)
|
|||||||
Password authentication (--password option)
|
Password authentication (--password option)
|
||||||
.SH OUTPUT
|
.SH OUTPUT
|
||||||
For each device, a text file named after the hostname is created in the specified directory. Each command output is prefixed with "## COMMAND: <command_name>" for easy identification.
|
For each device, a text file named after the hostname is created in the specified directory. Each command output is prefixed with "## COMMAND: <command_name>" for easy identification.
|
||||||
|
.PP
|
||||||
|
Output can be filtered using regex patterns defined in the device type's 'exclude' field to remove unwanted lines such as timestamps or debug messages.
|
||||||
.SH EXAMPLES
|
.SH EXAMPLES
|
||||||
.TP
|
.TP
|
||||||
Basic usage with glob patterns:
|
Basic usage with glob patterns:
|
||||||
|
Reference in New Issue
Block a user