sql-xel-parser 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. sql_xel_parser-1.0.0/.gitignore +106 -0
  2. sql_xel_parser-1.0.0/INSTALL.md +213 -0
  3. sql_xel_parser-1.0.0/LICENSE +21 -0
  4. sql_xel_parser-1.0.0/MANIFEST.in +16 -0
  5. sql_xel_parser-1.0.0/PKG-INFO +139 -0
  6. sql_xel_parser-1.0.0/PYPI.md +107 -0
  7. sql_xel_parser-1.0.0/QUICKSTART.md +134 -0
  8. sql_xel_parser-1.0.0/README.md +410 -0
  9. sql_xel_parser-1.0.0/docs/README.md +340 -0
  10. sql_xel_parser-1.0.0/examples/README.md +101 -0
  11. sql_xel_parser-1.0.0/examples/example_usage.py +337 -0
  12. sql_xel_parser-1.0.0/git-pull.sh +23 -0
  13. sql_xel_parser-1.0.0/git-push.sh +23 -0
  14. sql_xel_parser-1.0.0/git-sync.sh +31 -0
  15. sql_xel_parser-1.0.0/pyproject.toml +46 -0
  16. sql_xel_parser-1.0.0/requirements.txt +1 -0
  17. sql_xel_parser-1.0.0/setup.cfg +4 -0
  18. sql_xel_parser-1.0.0/setup.py +59 -0
  19. sql_xel_parser-1.0.0/sql_xel_parser/__init__.py +14 -0
  20. sql_xel_parser-1.0.0/sql_xel_parser/__main__.py +6 -0
  21. sql_xel_parser-1.0.0/sql_xel_parser/analyzer.py +380 -0
  22. sql_xel_parser-1.0.0/sql_xel_parser/cli.py +315 -0
  23. sql_xel_parser-1.0.0/sql_xel_parser/converter.py +284 -0
  24. sql_xel_parser-1.0.0/sql_xel_parser/parser.py +379 -0
  25. sql_xel_parser-1.0.0/sql_xel_parser/real_parser.py +295 -0
  26. sql_xel_parser-1.0.0/sql_xel_parser.egg-info/PKG-INFO +139 -0
  27. sql_xel_parser-1.0.0/sql_xel_parser.egg-info/SOURCES.txt +29 -0
  28. sql_xel_parser-1.0.0/sql_xel_parser.egg-info/dependency_links.txt +1 -0
  29. sql_xel_parser-1.0.0/sql_xel_parser.egg-info/entry_points.txt +2 -0
  30. sql_xel_parser-1.0.0/sql_xel_parser.egg-info/requires.txt +1 -0
  31. sql_xel_parser-1.0.0/sql_xel_parser.egg-info/top_level.txt +1 -0
@@ -0,0 +1,106 @@
1
+ # XEL Parser .gitignore
2
+
3
+ # Data directories
4
+ data/
5
+ *.xel
6
+
7
+ # Python
8
+ __pycache__/
9
+ *.py[cod]
10
+ *$py.class
11
+ *.so
12
+ .Python
13
+ build/
14
+ develop-eggs/
15
+ dist/
16
+ downloads/
17
+ eggs/
18
+ .eggs/
19
+ lib/
20
+ lib64/
21
+ parts/
22
+ sdist/
23
+ var/
24
+ wheels/
25
+ pip-wheel-metadata/
26
+ share/python-wheels/
27
+ *.egg-info/
28
+ .installed.cfg
29
+ *.egg
30
+ MANIFEST
31
+
32
+ # Virtual environments
33
+ venv/
34
+ ENV/
35
+ env/
36
+ .venv
37
+
38
+ # IDEs
39
+ .vscode/
40
+ .idea/
41
+ .claude/
42
+ *.swp
43
+ *.swo
44
+ *~
45
+ .DS_Store
46
+
47
+ # Testing
48
+ .tox/
49
+ .coverage
50
+ .coverage.*
51
+ .cache
52
+ nosetests.xml
53
+ coverage.xml
54
+ *.cover
55
+ .hypothesis/
56
+ .pytest_cache/
57
+
58
+ # Jupyter
59
+ .ipynb_checkpoints
60
+
61
+ # Distribution / packaging
62
+ .Python
63
+ pip-log.txt
64
+ pip-delete-this-directory.txt
65
+
66
+ # PyInstaller
67
+ *.manifest
68
+ *.spec
69
+
70
+ # Outputs
71
+ *.json
72
+ *.csv
73
+ *.txt
74
+ !requirements.txt
75
+ !LICENSE.txt
76
+ *.log
77
+
78
+ # macOS
79
+ .DS_Store
80
+ .AppleDouble
81
+ .LSOverride
82
+
83
+ # Thumbnails
84
+ ._*
85
+
86
+ # Files that might appear in the root
87
+ .DocumentRevisions-V100
88
+ .fseventsd
89
+ .Spotlight-V100
90
+ .TemporaryItems
91
+ .Trashes
92
+ .VolumeIcon.icns
93
+ .com.apple.timemachine.donotpresent
94
+
95
+ # Windows
96
+ Thumbs.db
97
+ ehthumbs.db
98
+ Desktop.ini
99
+ $RECYCLE.BIN/
100
+
101
+ # Project specific
102
+ test_events.xel
103
+ output*.json
104
+ big_sample.json
105
+ extracted_*.json
106
+ *.xel
@@ -0,0 +1,213 @@
1
+ # Installation Guide
2
+
3
+ ## Quick Install
4
+
5
+ ```bash
6
+ # Install from source
7
+ pip install -e .
8
+
9
+ # Or install from PyPI
10
+ pip install sql-xel-parser
11
+ ```
12
+
13
+ ## Usage After Installation
14
+
15
+ After installation, you can use the `sql-xel-parser` command directly:
16
+
17
+ ```bash
18
+ sql-xel-parser --help
19
+ sql-xel-parser input.xel -f json -o output.json
20
+ ```
21
+
22
+ ## Installation Methods
23
+
24
+ ### Method 1: Install from Source (Development)
25
+
26
+ ```bash
27
+ # Clone or navigate to the project directory
28
+ cd xel-log-parse
29
+
30
+ # Install in development mode
31
+ pip install -e .
32
+
33
+ # Test installation
34
+ sql-xel-parser --version
35
+ ```
36
+
37
+ ### Method 2: Install from Source (Standard)
38
+
39
+ ```bash
40
+ cd xel-log-parse
41
+ pip install .
42
+ ```
43
+
44
+ ### Method 3: Install from PyPI
45
+
46
+ ```bash
47
+ pip install sql-xel-parser
48
+ ```
49
+
50
+ ### Method 4: Install with pipx (Isolated)
51
+
52
+ ```bash
53
+ # Install pipx if you don't have it
54
+ python3 -m pip install --user pipx
55
+ python3 -m pipx ensurepath
56
+
57
+ # Install sql-xel-parser in isolated environment
58
+ pipx install /path/to/xel-log-parse
59
+
60
+ # Now sql-xel-parser command is globally available
61
+ sql-xel-parser --help
62
+ ```
63
+
64
+ ## Verify Installation
65
+
66
+ ```bash
67
+ # Check if package is installed
68
+ pip show sql-xel-parser
69
+
70
+ # Check version
71
+ sql-xel-parser --version
72
+
73
+ # Test with help
74
+ sql-xel-parser --help
75
+
76
+ # Test with real data
77
+ sql-xel-parser data/sql-ptfm-prod-westus3 -r --limit 5 -f summary
78
+ ```
79
+
80
+ ## Command Availability
81
+
82
+ The `sql-xel-parser` command will be available if your Python's `bin` directory is in your PATH:
83
+
84
+ ```bash
85
+ # Check if command is available
86
+ which sql-xel-parser
87
+
88
+ # If not found, you can:
89
+ # 1. Use: sql-xel-parser (works everywhere)
90
+ # 2. Add Python bin to PATH
91
+ # 3. Use the full path: /path/to/python/bin/sql-xel-parser
92
+ ```
93
+
94
+ ### Adding Python bin to PATH
95
+
96
+ **macOS/Linux:**
97
+ ```bash
98
+ # Find your Python bin directory
99
+ python -c "import sys; import os; print(os.path.dirname(sys.executable))"
100
+
101
+ # Add to your ~/.bashrc or ~/.zshrc
102
+ export PATH="/path/to/python/bin:$PATH"
103
+
104
+ # Reload shell
105
+ source ~/.bashrc # or source ~/.zshrc
106
+ ```
107
+
108
+ **Windows:**
109
+ ```cmd
110
+ # Add to PATH in System Environment Variables
111
+ # Or use: sql-xel-parser
112
+ ```
113
+
114
+ ## Dependencies
115
+
116
+ - Python 3.8 or higher
117
+ - python-dateutil (automatically installed)
118
+
119
+ ## Uninstall
120
+
121
+ ```bash
122
+ pip uninstall sql-xel-parser
123
+ ```
124
+
125
+ ## Development Setup
126
+
127
+ ```bash
128
+ # Clone repository
129
+ git clone https://github.com/josephvolmer/sql-xel-parser.git
130
+ cd sql-xel-parser
131
+
132
+ # Create virtual environment
133
+ python3 -m venv venv
134
+ source venv/bin/activate # On Windows: venv\Scripts\activate
135
+
136
+ # Install in development mode with dependencies
137
+ pip install -e .
138
+
139
+ # Run tests
140
+ sql-xel-parser data/test.xel -f summary
141
+ ```
142
+
143
+ ## Troubleshooting
144
+
145
+ ### Command not found: sql-xel-parser
146
+
147
+ **Solution**: Use `sql-xel-parser` instead, or add Python's bin directory to your PATH.
148
+
149
+ ### ImportError: No module named 'xel_parser'
150
+
151
+ **Solution**: Make sure you've installed the package:
152
+ ```bash
153
+ pip install -e .
154
+ ```
155
+
156
+ ### Permission denied when installing
157
+
158
+ **Solution**: Use `--user` flag:
159
+ ```bash
160
+ pip install --user -e .
161
+ ```
162
+
163
+ Or use a virtual environment:
164
+ ```bash
165
+ python3 -m venv venv
166
+ source venv/bin/activate
167
+ pip install -e .
168
+ ```
169
+
170
+ ## Quick Start Examples
171
+
172
+ ```bash
173
+ # After installation, try these commands:
174
+
175
+ # Parse single file
176
+ sql-xel-parser data/sql-ptfm-prod-westus3/master/SqlDbAuditing_ServerAudit/2026-03-03/19_00_56_668_0.xel -f summary
177
+
178
+ # Parse entire directory
179
+ sql-xel-parser data/sql-ptfm-prod-westus3 -r -f summary
180
+
181
+ # Export to JSON
182
+ sql-xel-parser data/sql-ptfm-prod-westus3 -r --limit 100 -o audit_data.json
183
+
184
+ # Search for specific content
185
+ sql-xel-parser data/sql-ptfm-prod-westus3 -r --search "Payments"
186
+
187
+ # Count events by type
188
+ sql-xel-parser data/sql-ptfm-prod-westus3 -r --count-by name
189
+ ```
190
+
191
+ ## Platform-Specific Notes
192
+
193
+ ### macOS
194
+ - Uses system Python or Homebrew Python
195
+ - Virtual environments recommended
196
+ - Use `python3` and `pip3` commands
197
+
198
+ ### Linux
199
+ - Usually has Python pre-installed
200
+ - May need to install `python3-venv` package
201
+ - Use `python3` and `pip3` commands
202
+
203
+ ### Windows
204
+ - Install Python from python.org
205
+ - Use `python` and `pip` commands
206
+ - May need to run as Administrator for system-wide install
207
+
208
+ ## Support
209
+
210
+ For issues or questions:
211
+ - Check the [README.md](README.md) for usage examples
212
+ - See [QUICKSTART.md](QUICKSTART.md) for quick start guide
213
+ - Report bugs at: https://github.com/josephvolmer/sql-xel-parser/issues
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 XEL Parser Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,16 @@
1
+ include README.md
2
+ include PYPI.md
3
+ include LICENSE
4
+ include requirements.txt
5
+ include QUICKSTART.md
6
+ include INSTALL.md
7
+ recursive-include docs *.md *.sql
8
+ recursive-include examples *.py
9
+ recursive-include sql_xel_parser *.py
10
+ prune data
11
+ prune __pycache__
12
+ prune .github
13
+ global-exclude *.pyc
14
+ global-exclude *.pyo
15
+ global-exclude *~
16
+ global-exclude .DS_Store
@@ -0,0 +1,139 @@
1
+ Metadata-Version: 2.4
2
+ Name: sql-xel-parser
3
+ Version: 1.0.0
4
+ Summary: Parse and analyze SQL Server Extended Events (.xel) files
5
+ Home-page: https://github.com/josephvolmer/sql-xel-parser
6
+ Author: SQL XEL Parser Contributors
7
+ Author-email:
8
+ License: MIT
9
+ Project-URL: Homepage, https://github.com/josephvolmer/sql-xel-parser
10
+ Project-URL: Documentation, https://github.com/josephvolmer/sql-xel-parser/blob/main/README.md
11
+ Project-URL: Repository, https://github.com/josephvolmer/sql-xel-parser
12
+ Project-URL: Bug Tracker, https://github.com/josephvolmer/sql-xel-parser/issues
13
+ Keywords: xel,sql-server,extended-events,audit-logs,parser
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: System Administrators
17
+ Classifier: Topic :: Database
18
+ Classifier: Topic :: System :: Logging
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.8
21
+ Classifier: Programming Language :: Python :: 3.9
22
+ Classifier: Programming Language :: Python :: 3.10
23
+ Classifier: Programming Language :: Python :: 3.11
24
+ Classifier: Programming Language :: Python :: 3.12
25
+ Requires-Python: >=3.8
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: python-dateutil>=2.8.0
29
+ Dynamic: home-page
30
+ Dynamic: license-file
31
+ Dynamic: requires-python
32
+
33
+ # SQL XEL Parser
34
+
35
+ Parse and analyze SQL Server Extended Events (.xel) files without requiring SQL Server.
36
+
37
+ Tested with **671 production Azure SQL audit log files**. Works cross-platform (Linux, macOS, Windows).
38
+
39
+ ## Features
40
+
41
+ ✅ **No SQL Server Required** - Parse binary XEL files using UTF-16 extraction
42
+ ✅ **Multiple Export Formats** - JSON, JSON Lines, CSV, Text, Markdown, Summary
43
+ ✅ **Advanced Filtering** - By event name, time range, field values, regex search
44
+ ✅ **Analysis Tools** - Aggregation, grouping, counting, top-N queries
45
+ ✅ **Batch Processing** - Recursive directory processing with 671+ file support
46
+ ✅ **Python API** - Use programmatically in your own scripts
47
+ ✅ **CLI Tool** - Powerful command-line interface
48
+
49
+ ## Installation
50
+
51
+ ```bash
52
+ pip install sql-xel-parser
53
+ ```
54
+
55
+ ## Quick Start
56
+
57
+ ### Command Line
58
+
59
+ ```bash
60
+ # Get summary of XEL files
61
+ sql-xel-parser audit.xel -f summary
62
+
63
+ # Export to JSON
64
+ sql-xel-parser audit.xel -o events.json
65
+
66
+ # Process entire directory
67
+ sql-xel-parser /path/to/logs/ -r -f summary
68
+
69
+ # Search for security events
70
+ sql-xel-parser audit.xel --search "fail|error|denied" -o security.json
71
+
72
+ # Export to CSV for Excel
73
+ sql-xel-parser audit.xel -f csv -o export.csv
74
+ ```
75
+
76
+ ### Python API
77
+
78
+ ```python
79
+ from sql_xel_parser import XELParser, XELAnalyzer, XELConverter
80
+
81
+ # Parse XEL file
82
+ parser = XELParser('audit.xel')
83
+ events = list(parser.parse())
84
+
85
+ # Analyze and filter
86
+ analyzer = XELAnalyzer(events)
87
+ failed_logins = analyzer.search('(?i)fail|error')
88
+
89
+ # Export results
90
+ converter = XELConverter()
91
+ json_output = converter.to_json(failed_logins.get_events(), indent=2)
92
+ ```
93
+
94
+ ## What Gets Extracted
95
+
96
+ **Successfully extracted:**
97
+ - Event names and types
98
+ - Timestamps
99
+ - SQL statements and error messages
100
+ - Server names, databases, IPs
101
+ - Usernames and session IDs
102
+ - All text-based audit data
103
+
104
+ **May be incomplete:**
105
+ - Pure numeric fields without string representation
106
+ - Binary data types (BLOB)
107
+ - Complex nested binary structures
108
+
109
+ Uses UTF-16 string extraction method - ideal for text-heavy events like audit logs and security monitoring.
110
+
111
+ ## Use Cases
112
+
113
+ - **Azure SQL Audit Logs** - Primary use case, tested with production data
114
+ - **Security & Compliance** - Track access patterns and failed logins
115
+ - **SQL Server Extended Events** - Parse system_health, query tracking
116
+ - **Automated Monitoring** - CI/CD pipelines and scheduled analysis
117
+ - **SIEM Integration** - Export to Splunk, ELK, or other log analysis tools
118
+
119
+ ## Documentation
120
+
121
+ - [Full Documentation](https://github.com/josephvolmer/sql-xel-parser)
122
+ - [Quick Start Guide](https://github.com/josephvolmer/sql-xel-parser/blob/main/QUICKSTART.md)
123
+ - [Advanced Usage](https://github.com/josephvolmer/sql-xel-parser/tree/main/docs)
124
+ - [Python API Examples](https://github.com/josephvolmer/sql-xel-parser/tree/main/examples)
125
+
126
+ ## Requirements
127
+
128
+ - Python 3.8+
129
+ - python-dateutil
130
+
131
+ ## License
132
+
133
+ MIT License
134
+
135
+ ## Links
136
+
137
+ - **GitHub**: https://github.com/josephvolmer/sql-xel-parser
138
+ - **Issues**: https://github.com/josephvolmer/sql-xel-parser/issues
139
+ - **Documentation**: https://github.com/josephvolmer/sql-xel-parser/blob/main/README.md
@@ -0,0 +1,107 @@
1
+ # SQL XEL Parser
2
+
3
+ Parse and analyze SQL Server Extended Events (.xel) files without requiring SQL Server.
4
+
5
+ Tested with **671 production Azure SQL audit log files**. Works cross-platform (Linux, macOS, Windows).
6
+
7
+ ## Features
8
+
9
+ ✅ **No SQL Server Required** - Parse binary XEL files using UTF-16 extraction
10
+ ✅ **Multiple Export Formats** - JSON, JSON Lines, CSV, Text, Markdown, Summary
11
+ ✅ **Advanced Filtering** - By event name, time range, field values, regex search
12
+ ✅ **Analysis Tools** - Aggregation, grouping, counting, top-N queries
13
+ ✅ **Batch Processing** - Recursive directory processing with 671+ file support
14
+ ✅ **Python API** - Use programmatically in your own scripts
15
+ ✅ **CLI Tool** - Powerful command-line interface
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ pip install sql-xel-parser
21
+ ```
22
+
23
+ ## Quick Start
24
+
25
+ ### Command Line
26
+
27
+ ```bash
28
+ # Get summary of XEL files
29
+ sql-xel-parser audit.xel -f summary
30
+
31
+ # Export to JSON
32
+ sql-xel-parser audit.xel -o events.json
33
+
34
+ # Process entire directory
35
+ sql-xel-parser /path/to/logs/ -r -f summary
36
+
37
+ # Search for security events
38
+ sql-xel-parser audit.xel --search "fail|error|denied" -o security.json
39
+
40
+ # Export to CSV for Excel
41
+ sql-xel-parser audit.xel -f csv -o export.csv
42
+ ```
43
+
44
+ ### Python API
45
+
46
+ ```python
47
+ from sql_xel_parser import XELParser, XELAnalyzer, XELConverter
48
+
49
+ # Parse XEL file
50
+ parser = XELParser('audit.xel')
51
+ events = list(parser.parse())
52
+
53
+ # Analyze and filter
54
+ analyzer = XELAnalyzer(events)
55
+ failed_logins = analyzer.search('(?i)fail|error')
56
+
57
+ # Export results
58
+ converter = XELConverter()
59
+ json_output = converter.to_json(failed_logins.get_events(), indent=2)
60
+ ```
61
+
62
+ ## What Gets Extracted
63
+
64
+ **Successfully extracted:**
65
+ - Event names and types
66
+ - Timestamps
67
+ - SQL statements and error messages
68
+ - Server names, databases, IPs
69
+ - Usernames and session IDs
70
+ - All text-based audit data
71
+
72
+ **May be incomplete:**
73
+ - Pure numeric fields without string representation
74
+ - Binary data types (BLOB)
75
+ - Complex nested binary structures
76
+
77
+ Uses UTF-16 string extraction method - ideal for text-heavy events like audit logs and security monitoring.
78
+
79
+ ## Use Cases
80
+
81
+ - **Azure SQL Audit Logs** - Primary use case, tested with production data
82
+ - **Security & Compliance** - Track access patterns and failed logins
83
+ - **SQL Server Extended Events** - Parse system_health, query tracking
84
+ - **Automated Monitoring** - CI/CD pipelines and scheduled analysis
85
+ - **SIEM Integration** - Export to Splunk, ELK, or other log analysis tools
86
+
87
+ ## Documentation
88
+
89
+ - [Full Documentation](https://github.com/josephvolmer/sql-xel-parser)
90
+ - [Quick Start Guide](https://github.com/josephvolmer/sql-xel-parser/blob/main/QUICKSTART.md)
91
+ - [Advanced Usage](https://github.com/josephvolmer/sql-xel-parser/tree/main/docs)
92
+ - [Python API Examples](https://github.com/josephvolmer/sql-xel-parser/tree/main/examples)
93
+
94
+ ## Requirements
95
+
96
+ - Python 3.8+
97
+ - python-dateutil
98
+
99
+ ## License
100
+
101
+ MIT License
102
+
103
+ ## Links
104
+
105
+ - **GitHub**: https://github.com/josephvolmer/sql-xel-parser
106
+ - **Issues**: https://github.com/josephvolmer/sql-xel-parser/issues
107
+ - **Documentation**: https://github.com/josephvolmer/sql-xel-parser/blob/main/README.md