CLI tools for Splunk 9.2.2 TA development and maintenance.
Currently Implementing:
-
P1: Basic CLI Structure ✓
- Command-line interface framework
- Help text and documentation
- Output formatting templates
- Error message formatting
- Verbosity controls
-
P2: Basic Validation ✓
- Core validation rules
- Validation command structure
- Validation reporting
- Error handling
-
P3: File Detection ✓
- TA directory validation
- Change detection and reporting
- Local/default file comparison
- Status display system
-
P4: Configuration Sorting ✓
- Stanza sorting by type and priority
- Setting organization within stanzas
- Structure and comment preservation
- Format maintenance
-
P5: Configuration Merging ✓
- Local to default file merging
- Conflict detection and resolution
- Format and structure preservation
- Backup mechanisms
Coming Soon:
- P6: Version Management
- Bump version numbers
- Tag releases
- Create release notes
Validates Splunk configuration files for syntax errors and structural issues.
bydefault validate [OPTIONS] FILES...Options:
--verbose, -v- Show detailed validation output--recursive, -r- Recursively scan directories for configuration files
Example:
bydefault validate default/*.conf
default/props.conf ✓
default/inputs.conf ✓
default/transforms.conf ✗
Line 15: Invalid stanza formatScans Splunk TA directories to detect configuration changes between local and default.
bydefault scan [OPTIONS] PATHS...Options:
--baseline, -b- Baseline TA to compare against--recursive, -r- Recursively search for TAs in directories--verbose, -v- Show more detailed output--summary, -s- Show only a summary of changes--details, -d- Show detailed changes (default)
Example:
bydefault scan path/to/ta
TA-example:
Changes detected: 3 files modified, 1 file added
Modified: local/props.conf
Modified: local/transforms.conf
Modified: local/macros.conf
Added: local/indexes.confSorts stanzas and settings in Splunk configuration files while preserving structure and comments.
bydefault sort [OPTIONS] FILES...Options:
--verbose, -v- Show detailed output--dry-run, -n- Show what would be done without making changes--backup, -b- Create backup before sorting--verify, -c- Verify file structure after sort
Example:
bydefault sort --backup default/props.conf
Sorted default/props.conf (backup created)Merges changes from Splunk TA's local directory into the default directory while preserving structure and comments.
bydefault merge [OPTIONS] PATHS...Options:
--verbose, -v- Show detailed output--dry-run, -n- Show what would be done without making changes--no-backup- Skip creating backup (backup is created by default)--mode- How to handle local changes (mergeorreplace, default:merge)--recursive, -r- Recursively search for TAs in the specified directories
Example:
bydefault merge path/to/ta
Created backup: path/to/ta/default.20240317_123456.bak
Merge completed successfully!-
Project Links
-
Documentation
byDefault provides a suite of command-line tools to assist Splunk developers in creating and maintaining Technology Add-ons (TAs) for Splunk 9.2.2. The tools are designed with security and maintainability in mind.
- UV package manager
- ~/.local/bin in PATH (or appropriate UV tools directory)
Note: Python is not required to be pre-installed. UV will automatically manage Python versions as needed.
UV is a fast, reliable, and feature-rich Python package installer and resolver.
Choose one of the following installation methods:
-
Install UV:
macOS (Recommended)
brew install uv
Linux/macOS (Alternative)
curl -LsSf https://astral.sh/uv/install.sh | shWindows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
-
The installation scripts automatically add UV to your PATH. Verify the installation:
uv --version
-
Install from GitHub Release (Recommended):
# Install from wheel file uv tool install https://github.com/BernCarney/bydefault/releases/download/v0.1.0/bydefault-0.1.0-py3-none-any.whl # Or latest release uv tool install git+https://github.com/BernCarney/bydefault.git@v0.1.0 # Or latest from main branch uv tool install git+https://github.com/BernCarney/bydefault.git # Or build from source uv tool install https://github.com/BernCarney/bydefault/releases/download/v0.1.0/bydefault-0.1.0.tar.gz
-
If you receive an error when installing byDefault saying you don't have the required python version, you can install the correct version of python using the following command:
uv python install 3.11
-
Make sure UV's tool directory is added to your path:
uv tool update-shell
-
Verify installation:
# After restarting your shell bydefault --version bydefault, version 0.3.0
Detect configuration changes:
$ bydefault scan
Changes detected in: my_custom_ta
Modified files:
local/props.conf
local/transforms.confSort configuration files:
$ bydefault sort default/props.conf
Sorting: default/props.conf
✓ Stanzas reordered: 5
✓ Settings sorted: 23Merge local changes to default:
$ bydefault merge
Merging changes in: my_custom_ta
✓ props.conf: 2 stanzas merged
✓ transforms.conf: 1 stanza mergedUpdate TA versions:
$ bydefault bumpver --minor
Updating versions:
my_custom_ta: 1.2.0 -> 1.3.0-
Clone the repository:
git clone <repository-url> cd bydefault
-
Create and activate a virtual environment:
uv venv source .venv/bin/activate # On Unix/macOS
-
Install development dependencies:
uv sync --all-extras
-
Run tests:
pytest
-
Run linting:
ruff check . -
Run formatting:
ruff format .
The project uses a generated Splunk TA (Technology Add-on) test environment for validation and testing. To set up this environment:
./scripts/create_test_tas.shThis creates a test_tas directory with various test configurations. The directory is excluded from Git tracking via .git/info/exclude rather than .gitignore to maintain visibility in Cursor IDE.
Important: Do not commit the test_tas directory to the repository.
bydefault/
├── src/
│ └── bydefault/
│ ├── __init__.py
│ ├── cli.py # Main CLI entry point
│ ├── commands/ # Command implementations
│ ├── core/ # Core business logic
│ ├── models/ # Data models
│ └── utils/ # Shared utilities
├── tests/
│ ├── conftest.py
│ ├── test_commands/
│ ├── test_core/
│ ├── test_models/
│ └── test_utils/
└── [core config files]- Keep your Python environment up to date
- Review all dependencies before installation
- Use appropriate access controls for any generated files
- Back up configurations before performing merges
GNU General Public License v3.0 or later
Currently implementing Phase 4: Configuration Sorting
Visit the Project Board for detailed task tracking.