logler 1.0.7__cp311-cp311-macosx_11_0_arm64.whl
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.
- logler/__init__.py +22 -0
- logler/bootstrap.py +57 -0
- logler/cache.py +75 -0
- logler/cli.py +589 -0
- logler/helpers.py +282 -0
- logler/investigate.py +3962 -0
- logler/llm_cli.py +1426 -0
- logler/log_reader.py +267 -0
- logler/parser.py +207 -0
- logler/safe_regex.py +124 -0
- logler/terminal.py +252 -0
- logler/tracker.py +138 -0
- logler/tree_formatter.py +807 -0
- logler/watcher.py +55 -0
- logler/web/__init__.py +3 -0
- logler/web/app.py +810 -0
- logler/web/static/css/tailwind.css +1 -0
- logler/web/static/css/tailwind.input.css +3 -0
- logler/web/static/logler-logo.png +0 -0
- logler/web/tailwind.config.cjs +9 -0
- logler/web/templates/index.html +1454 -0
- logler-1.0.7.dist-info/METADATA +584 -0
- logler-1.0.7.dist-info/RECORD +28 -0
- logler-1.0.7.dist-info/WHEEL +4 -0
- logler-1.0.7.dist-info/entry_points.txt +2 -0
- logler-1.0.7.dist-info/licenses/LICENSE +21 -0
- logler_rs/__init__.py +5 -0
- logler_rs/logler_rs.cpython-311-darwin.so +0 -0
|
@@ -0,0 +1,584 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: logler
|
|
3
|
+
Version: 1.0.7
|
|
4
|
+
Classifier: Development Status :: 4 - Beta
|
|
5
|
+
Classifier: Intended Audience :: Developers
|
|
6
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Topic :: Software Development :: Debuggers
|
|
13
|
+
Classifier: Topic :: System :: Logging
|
|
14
|
+
Requires-Dist: fastapi>=0.115.0
|
|
15
|
+
Requires-Dist: uvicorn[standard]>=0.30.0
|
|
16
|
+
Requires-Dist: rich>=13.0.0
|
|
17
|
+
Requires-Dist: watchdog>=4.0.0
|
|
18
|
+
Requires-Dist: python-multipart>=0.0.9
|
|
19
|
+
Requires-Dist: jinja2>=3.1.0
|
|
20
|
+
Requires-Dist: websockets>=12.0
|
|
21
|
+
Requires-Dist: aiofiles>=23.0.0
|
|
22
|
+
Requires-Dist: click>=8.1.0
|
|
23
|
+
Requires-Dist: pytest>=8.0.0 ; extra == 'dev'
|
|
24
|
+
Requires-Dist: pytest-asyncio>=0.23.0 ; extra == 'dev'
|
|
25
|
+
Requires-Dist: black>=24.0.0 ; extra == 'dev'
|
|
26
|
+
Requires-Dist: ruff>=0.3.0 ; extra == 'dev'
|
|
27
|
+
Requires-Dist: httpx>=0.28.0 ; extra == 'dev'
|
|
28
|
+
Requires-Dist: maturin>=1.10.0 ; extra == 'dev'
|
|
29
|
+
Requires-Dist: patchelf>=0.17.0 ; extra == 'dev'
|
|
30
|
+
Requires-Dist: marimo>=0.10.0 ; extra == 'dev'
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
License-File: LICENSE
|
|
33
|
+
Summary: Beautiful local log viewer with thread tracking and real-time updates
|
|
34
|
+
Keywords: logs,logging,viewer,monitoring,debugging
|
|
35
|
+
Author: Logler Contributors
|
|
36
|
+
License: MIT
|
|
37
|
+
Requires-Python: >=3.9
|
|
38
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
39
|
+
Project-URL: Documentation, https://github.com/gabu-quest/logler#readme
|
|
40
|
+
Project-URL: Homepage, https://github.com/gabu-quest/logler
|
|
41
|
+
Project-URL: Repository, https://github.com/gabu-quest/logler
|
|
42
|
+
|
|
43
|
+
# Logler ๐
|
|
44
|
+
|
|
45
|
+
**Beautiful local log viewer with thread tracking and real-time updates**
|
|
46
|
+
|
|
47
|
+
[](https://badge.fury.io/py/logler)
|
|
48
|
+
[](https://www.python.org/downloads/)
|
|
49
|
+
|
|
50
|
+
A modern, feature-rich log viewer that makes debugging a pleasure. View logs in your terminal with beautiful colors or start a web interface with WebSocket support for real-time updates.
|
|
51
|
+
|
|
52
|
+
## โจ Features
|
|
53
|
+
|
|
54
|
+
- ๐จ **Beautiful Terminal Output** - Rich colors and formatting with thread visualization
|
|
55
|
+
- ๐ **Gorgeous Web UI** - Modern interface with file picker and live updates
|
|
56
|
+
- ๐งต **Thread Tracking** - Follow execution flow across log entries
|
|
57
|
+
- ๐ **Correlation IDs** - Track requests across microservices
|
|
58
|
+
- ๐ **Distributed Tracing** - OpenTelemetry span/trace support
|
|
59
|
+
- โก **Real-time Streaming** - WebSocket support for live log following
|
|
60
|
+
- ๐ **Smart Filtering** - By level, thread, pattern, or correlation ID
|
|
61
|
+
- ๐ **Multi-Format Support** - JSON, plain text, syslog, and more
|
|
62
|
+
- ๐ **File Picker** - Browse and select log files from the UI
|
|
63
|
+
- ๐ฏ **Zero Config** - Works out of the box
|
|
64
|
+
|
|
65
|
+
## ๐ค NEW: LLM Investigation Engine
|
|
66
|
+
|
|
67
|
+
**Rust-powered log investigation designed for AI agents - the most LLM-friendly log tool available!**
|
|
68
|
+
|
|
69
|
+
### Core Features
|
|
70
|
+
- โก **Blazing Fast** - Search 1GB files in <50ms with parallel processing
|
|
71
|
+
- ๐ **Semantic Search** - Find errors by description, not just exact matches
|
|
72
|
+
- ๐งต **Thread Following** - Reconstruct request flows across distributed systems
|
|
73
|
+
- ๐ณ **Hierarchy Visualization** - Tree and waterfall views of nested operations, bottleneck detection
|
|
74
|
+
- ๐ **Pattern Detection** - Automatically find repeated errors and cascading failures
|
|
75
|
+
- ๐พ **SQL Queries** - DuckDB-powered custom analysis for deep investigation
|
|
76
|
+
- ๐ **Statistical Analysis** - Z-scores, percentiles, correlations, anomaly detection
|
|
77
|
+
- ๐ **Bilingual Docs** - Complete documentation in English and Japanese (ๆฅๆฌ่ช)
|
|
78
|
+
|
|
79
|
+
### ๐ NEW: Advanced LLM Features
|
|
80
|
+
|
|
81
|
+
**Designed specifically for AI agents with limited context windows:**
|
|
82
|
+
|
|
83
|
+
- ๐ก **Auto Insights** - `analyze_with_insights()` automatically detects patterns, errors, and suggests next steps
|
|
84
|
+
- ๐ **Token-Efficient Output** - 44x token savings with summary/count/compact modes
|
|
85
|
+
- ๐ **Compare & Diff** - Compare successful vs failed requests, before/after deployments
|
|
86
|
+
- ๐ **Cross-Service Timeline** - Unified view across microservices for distributed debugging
|
|
87
|
+
- ๐ **Investigation Sessions** - Track progress, undo/redo, save/resume investigations
|
|
88
|
+
- ๐ฏ **Smart Sampling** - Representative sampling with multiple strategies (diverse, errors-focused, chronological)
|
|
89
|
+
- ๐ **Report Generation** - Auto-generate markdown/text/JSON reports from investigation
|
|
90
|
+
- ๐ค **Explain Feature** - Plain English explanations of cryptic errors with next steps
|
|
91
|
+
- ๐ฌ **Contextual Suggestions** - AI suggests what to investigate next based on findings
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
import logler.investigate as investigate
|
|
95
|
+
|
|
96
|
+
# ๐ฏ One-line auto investigation with insights
|
|
97
|
+
result = investigate.analyze_with_insights(files=["app.log"])
|
|
98
|
+
print(result['insights']) # Automatic pattern detection, error analysis, suggestions
|
|
99
|
+
|
|
100
|
+
# ๐ Token-efficient search (44x smaller output)
|
|
101
|
+
errors = investigate.search(files=["app.log"], level="ERROR", output_format="summary")
|
|
102
|
+
# Returns aggregated stats instead of all entries - perfect for limited context windows
|
|
103
|
+
|
|
104
|
+
# ๐ Compare successful vs failed requests
|
|
105
|
+
diff = investigate.compare_threads(
|
|
106
|
+
files=["app.log"],
|
|
107
|
+
correlation_a="req-success-123",
|
|
108
|
+
correlation_b="req-failed-456"
|
|
109
|
+
)
|
|
110
|
+
print(diff['summary']) # "Thread B took 2341ms longer and had 5 errors (cache miss, timeout)"
|
|
111
|
+
|
|
112
|
+
# ๐ Cross-service distributed tracing
|
|
113
|
+
timeline = investigate.cross_service_timeline(
|
|
114
|
+
files={"api": ["api.log"], "db": ["db.log"], "cache": ["cache.log"]},
|
|
115
|
+
correlation_id="req-12345"
|
|
116
|
+
)
|
|
117
|
+
# See request flow: API โ DB โ Cache with latency breakdown
|
|
118
|
+
|
|
119
|
+
# ๐ Track investigation with sessions
|
|
120
|
+
session = investigate.InvestigationSession(files=["app.log"], name="incident_2024")
|
|
121
|
+
session.search(level="ERROR")
|
|
122
|
+
session.find_patterns()
|
|
123
|
+
session.add_note("Database connection pool exhausted")
|
|
124
|
+
report = session.generate_report(format="markdown") # Auto-generate report
|
|
125
|
+
|
|
126
|
+
# ๐ฏ Smart sampling (representative sample of huge logs)
|
|
127
|
+
sample = investigate.smart_sample(
|
|
128
|
+
files=["huge.log"],
|
|
129
|
+
strategy="errors_focused", # or "diverse", "representative", "chronological"
|
|
130
|
+
sample_size=50
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
# ๐ค Explain cryptic errors in plain English
|
|
134
|
+
explanation = investigate.explain(error_message="Connection pool exhausted", context="production")
|
|
135
|
+
print(explanation) # Common causes, next steps, production-specific advice
|
|
136
|
+
|
|
137
|
+
# ๐ณ Hierarchical thread visualization (NEW!)
|
|
138
|
+
hierarchy = investigate.follow_thread_hierarchy(
|
|
139
|
+
files=["app.log"],
|
|
140
|
+
root_identifier="req-123",
|
|
141
|
+
min_confidence=0.8 # Only show high-confidence relationships
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
# Automatic bottleneck detection
|
|
145
|
+
if hierarchy['bottleneck']:
|
|
146
|
+
print(f"Bottleneck: {hierarchy['bottleneck']['node_id']} took {hierarchy['bottleneck']['duration_ms']}ms")
|
|
147
|
+
|
|
148
|
+
# Get summary
|
|
149
|
+
summary = investigate.get_hierarchy_summary(hierarchy)
|
|
150
|
+
print(summary) # Shows tree structure, errors, bottlenecks
|
|
151
|
+
|
|
152
|
+
# Visualize in CLI
|
|
153
|
+
from tree_formatter import print_tree, print_waterfall
|
|
154
|
+
print_tree(hierarchy, mode="detailed", show_duration=True)
|
|
155
|
+
print_waterfall(hierarchy, width=100) # Waterfall timeline showing parallel operations
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**๐ Complete LLM documentation:**
|
|
159
|
+
- [English Guide](docs/LLM_README.md) - Complete API and examples
|
|
160
|
+
- [ๆฅๆฌ่ชใฌใคใ](README.ja.md) - ๅฎๅ
จใชใใญใฅใกใณใ
|
|
161
|
+
- [API Reference](docs/LLM_INVESTIGATION_API.md) - All investigation tools
|
|
162
|
+
- [Examples](examples/) - Production incident investigations
|
|
163
|
+
|
|
164
|
+
## ๐ Quick Start
|
|
165
|
+
|
|
166
|
+
### Installation
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
# Using pip
|
|
170
|
+
pip install logler
|
|
171
|
+
|
|
172
|
+
# Using uv (recommended)
|
|
173
|
+
uv pip install logler
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Usage
|
|
177
|
+
|
|
178
|
+
**Start the web interface:**
|
|
179
|
+
```bash
|
|
180
|
+
logler serve # Start with file picker
|
|
181
|
+
logler serve app.log # Open specific file
|
|
182
|
+
logler serve *.log # Open multiple files
|
|
183
|
+
logler serve --open # Auto-open browser
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Security and path restrictions
|
|
187
|
+
|
|
188
|
+
- The legacy Python web UI now enforces a **log root** to avoid accidental exposure of arbitrary files. Set `LOGLER_ROOT` to
|
|
189
|
+
the directory you want to browse (defaults to the current working directory). Requests outside that root are rejected.
|
|
190
|
+
- For production or remote access, place the service behind authentication/reverse proxies; the built-in UI is intended for
|
|
191
|
+
local or trusted environments only.
|
|
192
|
+
|
|
193
|
+
**View logs in terminal:**
|
|
194
|
+
```bash
|
|
195
|
+
logler view app.log # View entire file
|
|
196
|
+
logler view app.log -n 100 # Last 100 lines
|
|
197
|
+
logler view app.log -f # Follow in real-time
|
|
198
|
+
logler view app.log --level ERROR # Filter by level
|
|
199
|
+
logler view app.log --grep "timeout" # Search pattern
|
|
200
|
+
logler view app.log --thread worker-1 # Filter by thread
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
**Show statistics:**
|
|
204
|
+
```bash
|
|
205
|
+
logler stats app.log # Show statistics
|
|
206
|
+
logler stats app.log --json # JSON output
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
**Investigate logs with smart analysis:**
|
|
210
|
+
```bash
|
|
211
|
+
logler investigate app.log --auto-insights # Auto-detect issues
|
|
212
|
+
logler investigate app.log --errors # Analyze errors
|
|
213
|
+
logler investigate app.log --patterns # Find repeated patterns
|
|
214
|
+
logler investigate app.log --thread worker-1 # Follow specific thread
|
|
215
|
+
logler investigate app.log --correlation req-123 # Follow correlation ID
|
|
216
|
+
logler investigate app.log --output summary # Token-efficient output
|
|
217
|
+
|
|
218
|
+
# ๐ณ NEW: Hierarchical Thread Visualization
|
|
219
|
+
logler investigate app.log --correlation req-123 --hierarchy # Show thread hierarchy tree
|
|
220
|
+
logler investigate app.log --trace trace-abc123 --hierarchy --waterfall # Show waterfall timeline
|
|
221
|
+
logler investigate app.log --correlation req-123 --hierarchy --flamegraph # Show flamegraph view
|
|
222
|
+
logler investigate app.log --hierarchy --show-error-flow # Analyze error propagation
|
|
223
|
+
logler investigate app.log --thread worker-1 --hierarchy --max-depth 3 # Limit hierarchy depth
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Visualization Modes
|
|
227
|
+
|
|
228
|
+
**Tree View** - Shows parent-child relationships:
|
|
229
|
+
```
|
|
230
|
+
๐งต api-gateway (req-001, 520ms)
|
|
231
|
+
โโ ๐น auth-service (45ms)
|
|
232
|
+
โ โโ ๐ธ jwt-validate (5ms)
|
|
233
|
+
โ โโ ๐ธ user-lookup (25ms)
|
|
234
|
+
โโ ๐น product-service (450ms) โ ๏ธ SLOW
|
|
235
|
+
โ โโ ๐ธ inventory-check (340ms)
|
|
236
|
+
โ โ โโ ๐ธ db-query (300ms) โ ๏ธ
|
|
237
|
+
โ โโ ๐ธ cache-update (45ms) โ ERROR
|
|
238
|
+
โโ ๐น response-assembly (10ms)
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
**Waterfall View** (`--waterfall`) - Shows temporal overlap:
|
|
242
|
+
```
|
|
243
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
244
|
+
โ Timeline: req-001 (520ms) โ
|
|
245
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
|
|
246
|
+
โ api-gateway โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 520ms โ
|
|
247
|
+
โ โโ auth-service โโโโ 45ms โ
|
|
248
|
+
โ โโ product-service โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 450ms โ
|
|
249
|
+
โ โ โโ inventory โโโโโโโโโโโโโโโโโโโโโโ 340ms โ
|
|
250
|
+
โ โ โโ cache-update โโโโโ 45ms โ
|
|
251
|
+
โ โโ response โโ 10ms โ
|
|
252
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
**Flamegraph View** (`--flamegraph`) - Shows time distribution:
|
|
256
|
+
```
|
|
257
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
258
|
+
โ api-gateway (520ms) โ
|
|
259
|
+
โโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
|
|
260
|
+
โ auth (45) โ product-service (450ms) โ โ
|
|
261
|
+
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโค
|
|
262
|
+
โ โ inventory-check (340ms) โ cache-update (45ms) โ โ
|
|
263
|
+
โโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
**Error Flow** (`--show-error-flow`) - Traces error propagation:
|
|
267
|
+
```
|
|
268
|
+
๐ Error Flow Analysis
|
|
269
|
+
|
|
270
|
+
Root Cause:
|
|
271
|
+
โ cache-update failed at 10:00:00.450Z
|
|
272
|
+
Error: Redis connection refused
|
|
273
|
+
Path: api-gateway โ product-service โ cache-update
|
|
274
|
+
|
|
275
|
+
Impact: 3 nodes affected, request degraded
|
|
276
|
+
Recommendation: Check Redis connectivity
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
**Watch for new files:**
|
|
280
|
+
```bash
|
|
281
|
+
logler watch "*.log" # Watch for new log files
|
|
282
|
+
logler watch "app-*.log" -d /var/log # Specific directory
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
## ๐ธ Screenshots
|
|
286
|
+
|
|
287
|
+
### Web Interface
|
|
288
|
+
Beautiful, modern web UI with file picker and real-time updates:
|
|
289
|
+
- ๐ Browse and select log files
|
|
290
|
+
- ๐จ Syntax-highlighted logs
|
|
291
|
+
- ๐งต Thread visualization
|
|
292
|
+
- ๐ Live statistics
|
|
293
|
+
- ๐ Real-time following with WebSocket
|
|
294
|
+
|
|
295
|
+
### Terminal
|
|
296
|
+
Rich, colorful terminal output:
|
|
297
|
+
- ๐ Color-coded log levels
|
|
298
|
+
- ๐งต Thread badges
|
|
299
|
+
- ๐ Correlation ID tracking
|
|
300
|
+
- ๐ Thread timelines
|
|
301
|
+
|
|
302
|
+
## ๐ฏ Examples
|
|
303
|
+
|
|
304
|
+
### Web Interface
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
# Start server and auto-open browser
|
|
308
|
+
logler serve --open
|
|
309
|
+
|
|
310
|
+
# Start with specific files
|
|
311
|
+
logler serve /var/log/app.log /var/log/error.log
|
|
312
|
+
|
|
313
|
+
# Custom host/port
|
|
314
|
+
logler serve --host 0.0.0.0 --port 9000
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
Then open your browser to `http://localhost:8000` and:
|
|
318
|
+
1. Click "๐ Open File" to browse log files
|
|
319
|
+
2. Filter by level, search, or thread
|
|
320
|
+
3. Click "๐ Follow" for real-time streaming
|
|
321
|
+
4. View thread timelines and statistics
|
|
322
|
+
|
|
323
|
+
### Terminal Viewing
|
|
324
|
+
|
|
325
|
+
```bash
|
|
326
|
+
# Basic viewing
|
|
327
|
+
logler view app.log
|
|
328
|
+
|
|
329
|
+
# Follow with filters
|
|
330
|
+
logler view app.log -f --level ERROR --grep "database"
|
|
331
|
+
|
|
332
|
+
# Multiple files
|
|
333
|
+
logler view app.log error.log -n 50
|
|
334
|
+
|
|
335
|
+
# Beautiful thread view
|
|
336
|
+
logler view app.log --thread worker-1
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### Statistics
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
# Human-readable stats
|
|
343
|
+
logler stats app.log
|
|
344
|
+
|
|
345
|
+
# JSON for scripting
|
|
346
|
+
logler stats app.log --json | jq '.by_level'
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### Investigation & Analysis
|
|
350
|
+
|
|
351
|
+
```bash
|
|
352
|
+
# Auto-detect issues with insights
|
|
353
|
+
logler investigate app.log --auto-insights
|
|
354
|
+
# Output: Automatic error analysis, pattern detection, actionable suggestions
|
|
355
|
+
|
|
356
|
+
# Analyze errors with context
|
|
357
|
+
logler investigate app.log --errors
|
|
358
|
+
# Shows error frequency, top error messages, time ranges
|
|
359
|
+
|
|
360
|
+
# Find repeated patterns
|
|
361
|
+
logler investigate app.log --patterns --min-occurrences 5
|
|
362
|
+
# Identifies logs that repeat 5+ times
|
|
363
|
+
|
|
364
|
+
# Follow a specific thread or request
|
|
365
|
+
logler investigate app.log --thread worker-1
|
|
366
|
+
logler investigate app.log --correlation req-abc123
|
|
367
|
+
|
|
368
|
+
# Token-efficient output for LLMs
|
|
369
|
+
logler investigate app.log --auto-insights --output summary
|
|
370
|
+
# Returns aggregated statistics instead of full logs
|
|
371
|
+
|
|
372
|
+
# JSON output for automation
|
|
373
|
+
logler investigate app.log --errors --json
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
## ๐จ Log Format Support
|
|
377
|
+
|
|
378
|
+
Logler automatically detects and parses:
|
|
379
|
+
|
|
380
|
+
**JSON Logs:**
|
|
381
|
+
```json
|
|
382
|
+
{
|
|
383
|
+
"timestamp": "2024-01-15T10:00:00Z",
|
|
384
|
+
"level": "INFO",
|
|
385
|
+
"message": "User logged in",
|
|
386
|
+
"thread_id": "worker-1",
|
|
387
|
+
"correlation_id": "req-123",
|
|
388
|
+
"trace_id": "abc123",
|
|
389
|
+
"span_id": "span-001"
|
|
390
|
+
}
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
**Plain Text:**
|
|
394
|
+
```
|
|
395
|
+
2024-01-15 10:00:00 INFO [worker-1] [req-123] User logged in
|
|
396
|
+
2024-01-15 10:00:01 ERROR [worker-2] Database timeout trace_id=abc123
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
**With Thread Tracking:**
|
|
400
|
+
```
|
|
401
|
+
2024-01-15 10:00:00 INFO [worker-1] Request started
|
|
402
|
+
2024-01-15 10:00:01 DEBUG [worker-1] Processing...
|
|
403
|
+
2024-01-15 10:00:02 INFO [worker-1] Request completed
|
|
404
|
+
```
|
|
405
|
+
Logler groups these together and shows the complete thread timeline!
|
|
406
|
+
|
|
407
|
+
### ๐ฏ Perfect Log Format for Maximum Features
|
|
408
|
+
|
|
409
|
+
To unlock **all** of logler's capabilities (especially multi-level thread hierarchy), use this format:
|
|
410
|
+
|
|
411
|
+
**JSON (Recommended):**
|
|
412
|
+
```json
|
|
413
|
+
{
|
|
414
|
+
"timestamp": "2024-01-15T10:00:00.123Z",
|
|
415
|
+
"level": "INFO",
|
|
416
|
+
"message": "Processing user request",
|
|
417
|
+
"thread_id": "worker-1",
|
|
418
|
+
"correlation_id": "req-abc123",
|
|
419
|
+
"trace_id": "trace-xyz789",
|
|
420
|
+
"span_id": "span-001",
|
|
421
|
+
"parent_span_id": "span-000"
|
|
422
|
+
}
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
**Field Guide:**
|
|
426
|
+
|
|
427
|
+
| Field | Purpose | Enables |
|
|
428
|
+
|-------|---------|---------|
|
|
429
|
+
| `timestamp` | When the event occurred (ISO 8601) | Timeline, duration analysis |
|
|
430
|
+
| `level` | Log level (DEBUG/INFO/WARN/ERROR/FATAL) | Filtering, error detection |
|
|
431
|
+
| `message` | Human-readable description | Search, pattern detection |
|
|
432
|
+
| `thread_id` | Thread/worker identifier | Thread grouping, timeline |
|
|
433
|
+
| `correlation_id` | Request ID across services | Cross-service tracing |
|
|
434
|
+
| `trace_id` | Distributed trace identifier | OpenTelemetry integration |
|
|
435
|
+
| `span_id` | Unique operation identifier | Hierarchy building |
|
|
436
|
+
| `parent_span_id` | Parent operation's span_id | **Multi-level hierarchy trees** |
|
|
437
|
+
|
|
438
|
+
**Why `parent_span_id` matters:**
|
|
439
|
+
|
|
440
|
+
Without it, logler infers hierarchy from naming patterns (`worker-1.task-a`) or temporal proximity. With explicit `parent_span_id`, you get:
|
|
441
|
+
- 100% accurate parent-child relationships
|
|
442
|
+
- Deep hierarchy trees (not just 1-2 levels)
|
|
443
|
+
- Precise bottleneck detection
|
|
444
|
+
- Accurate error propagation tracing
|
|
445
|
+
|
|
446
|
+
**Plain Text Alternative:**
|
|
447
|
+
```
|
|
448
|
+
2024-01-15T10:00:00.123Z INFO [worker-1] [req-abc123] [trace:xyz789] [span:001] [parent:000] Processing user request
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
Logler will parse bracketed fields automatically. Use consistent formatting across your application.
|
|
452
|
+
|
|
453
|
+
## ๐งต Thread Tracking
|
|
454
|
+
|
|
455
|
+
Logler automatically tracks threads and shows:
|
|
456
|
+
- ๐ Log count per thread
|
|
457
|
+
- โ Error count per thread
|
|
458
|
+
- โฑ๏ธ Thread duration
|
|
459
|
+
- ๐ Associated correlation IDs
|
|
460
|
+
- ๐ Thread timeline
|
|
461
|
+
|
|
462
|
+
**Example:**
|
|
463
|
+
```bash
|
|
464
|
+
logler view app.log
|
|
465
|
+
```
|
|
466
|
+
Shows threads in sidebar with:
|
|
467
|
+
- Thread ID badge
|
|
468
|
+
- Number of logs
|
|
469
|
+
- Error count (if any)
|
|
470
|
+
|
|
471
|
+
Click any thread to filter logs!
|
|
472
|
+
|
|
473
|
+
## ๐ Correlation & Tracing
|
|
474
|
+
|
|
475
|
+
Track requests across services:
|
|
476
|
+
|
|
477
|
+
```bash
|
|
478
|
+
# Logs with correlation IDs are automatically linked
|
|
479
|
+
logler view app.log
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
In the web UI:
|
|
483
|
+
- See correlation IDs in log entries
|
|
484
|
+
- Filter by correlation ID
|
|
485
|
+
- View complete request flow
|
|
486
|
+
- Track distributed traces
|
|
487
|
+
|
|
488
|
+
## โ๏ธ Configuration
|
|
489
|
+
|
|
490
|
+
Logler works with zero configuration, but you can customize:
|
|
491
|
+
|
|
492
|
+
```bash
|
|
493
|
+
# Server options
|
|
494
|
+
logler serve --host 0.0.0.0 --port 8000
|
|
495
|
+
|
|
496
|
+
# View options
|
|
497
|
+
logler view app.log --no-color # Disable colors
|
|
498
|
+
logler view app.log -n 1000 # Show more lines
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
## ๐ ๏ธ Development
|
|
502
|
+
|
|
503
|
+
```bash
|
|
504
|
+
# Clone repository
|
|
505
|
+
git clone https://github.com/gabu-quest/logler.git
|
|
506
|
+
cd logler
|
|
507
|
+
|
|
508
|
+
# Install in development mode
|
|
509
|
+
pip install -e ".[dev]"
|
|
510
|
+
|
|
511
|
+
# Run tests
|
|
512
|
+
pytest
|
|
513
|
+
|
|
514
|
+
# Format code
|
|
515
|
+
black logler
|
|
516
|
+
ruff check logler
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
## ๐ฆ What's Included
|
|
520
|
+
|
|
521
|
+
- **logler** - Main CLI command
|
|
522
|
+
- **Rich Terminal UI** - Beautiful colored output
|
|
523
|
+
- **FastAPI Web Server** - Modern web interface
|
|
524
|
+
- **WebSocket Support** - Real-time log streaming
|
|
525
|
+
- **Thread Tracker** - Correlation and grouping
|
|
526
|
+
- **Smart Parser** - Multi-format support
|
|
527
|
+
- **File Watcher** - Monitor for new files
|
|
528
|
+
|
|
529
|
+
## ๐ค Contributing
|
|
530
|
+
|
|
531
|
+
Contributions welcome! Please feel free to submit a Pull Request.
|
|
532
|
+
|
|
533
|
+
## ๐ License
|
|
534
|
+
|
|
535
|
+
MIT License - see LICENSE file for details.
|
|
536
|
+
|
|
537
|
+
## ๐ Acknowledgments
|
|
538
|
+
|
|
539
|
+
Built with:
|
|
540
|
+
- [Rich](https://github.com/Textualize/rich) - Beautiful terminal output
|
|
541
|
+
- [FastAPI](https://fastapi.tiangolo.com/) - Modern web framework
|
|
542
|
+
- [HTMX](https://htmx.org/) - Dynamic web UI
|
|
543
|
+
- [TailwindCSS](https://tailwindcss.com/) - Styling
|
|
544
|
+
- [Alpine.js](https://alpinejs.dev/) - Reactive components
|
|
545
|
+
|
|
546
|
+
## ๐ก Pro Tips
|
|
547
|
+
|
|
548
|
+
1. **Use `--follow` mode** for real-time debugging
|
|
549
|
+
2. **Filter by thread** to trace execution flow
|
|
550
|
+
3. **Use the web UI** for complex log analysis
|
|
551
|
+
4. **Export stats as JSON** for automation
|
|
552
|
+
5. **Watch directories** for new log files
|
|
553
|
+
|
|
554
|
+
## ๐ Examples
|
|
555
|
+
|
|
556
|
+
### Debug a specific request
|
|
557
|
+
```bash
|
|
558
|
+
# Find correlation ID
|
|
559
|
+
logler view app.log --grep "req-12345"
|
|
560
|
+
|
|
561
|
+
# Follow that request across services
|
|
562
|
+
logler view app.log service.log --grep "req-12345"
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
### Monitor errors in real-time
|
|
566
|
+
```bash
|
|
567
|
+
logler view app.log -f --level ERROR
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
### Analyze thread behavior
|
|
571
|
+
```bash
|
|
572
|
+
logler view app.log --thread worker-1
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
### Beautiful web dashboard
|
|
576
|
+
```bash
|
|
577
|
+
logler serve app.log --open
|
|
578
|
+
# Then explore threads, traces, and statistics!
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
---
|
|
582
|
+
|
|
583
|
+
**Made with โค๏ธ for developers who love beautiful tools**
|
|
584
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
logler/__init__.py,sha256=0WHiHld8WxfO6VAlSVrrguLyPJy3dYsVWs4RIAB5rK8,513
|
|
2
|
+
logler/bootstrap.py,sha256=mpc3VUHDPXbMYj1xlZuGmx4I6vSRjL880TuJpBkZj4k,1289
|
|
3
|
+
logler/cache.py,sha256=HxJZ_s2yzhMgz77QpSKgdC8UZextS0PKgtmi0yHnfu8,2324
|
|
4
|
+
logler/cli.py,sha256=87E4V9Ow8A26y4ymyZANLuHkL3bXXteQ3nRAl0y2wcA,22816
|
|
5
|
+
logler/helpers.py,sha256=lhv_a6RQ97JcOp8SVhwVEdFhT-rfMSxf4fqe9a_Xsfk,9182
|
|
6
|
+
logler/investigate.py,sha256=0VCqkTB_U6oc2BfCdLZox94QZo1UliMHrg-2-4TBSQw,136461
|
|
7
|
+
logler/llm_cli.py,sha256=JryWimoTHkvOv1F0IyJmRhoDR0rei48toXrUlLgvo8s,49268
|
|
8
|
+
logler/log_reader.py,sha256=VCnvlj90peG-jFPJujyV7WzSk-fFdefLs_xAhON6lhA,8545
|
|
9
|
+
logler/parser.py,sha256=GyOP0WnpkvaLP-ZZ3ufmyUb3XRM02SDkt6R5msR7vXc,6484
|
|
10
|
+
logler/safe_regex.py,sha256=K7ryQSvUrTZG8bynJ2K1s7TdBup9hW3DJvQlG9yJ3vA,3431
|
|
11
|
+
logler/terminal.py,sha256=46iQAxU7mX5OVC8GhWi_aSs1hRGCNS3Ub_XmguMPWS8,8103
|
|
12
|
+
logler/tracker.py,sha256=zlVFr3H7ev1A7klziVwNwpZ9_PH9eShyJYU4AI7wXaw,4656
|
|
13
|
+
logler/tree_formatter.py,sha256=ZIG12bt7MfbTk4vLwtvvE9MUGIKBjBl1wn57jpjbmhg,27576
|
|
14
|
+
logler/watcher.py,sha256=p5HyCjVy7O14CA-RI8_HoZbZXdXHaNy04_gs60vqQt4,1526
|
|
15
|
+
logler/web/__init__.py,sha256=5UhDXVGSD9f7hGVVgsU1cJha1lHeZvP5tAYr3oUf09Q,34
|
|
16
|
+
logler/web/app.py,sha256=vY8HZPaul5PLuHR-cIZ7l6pYWv7K0ORDyN5-2FH3Ui4,25927
|
|
17
|
+
logler/web/static/css/tailwind.css,sha256=mUKXSL_ROgO2A1hhOcPxQhvUmdRl72RNRZUGTQSKZkU,12743
|
|
18
|
+
logler/web/static/css/tailwind.input.css,sha256=zBp60NAZ3bHTLQ7LWIugrCbOQdhiXdbDZjSLJfg6KOw,59
|
|
19
|
+
logler/web/static/logler-logo.png,sha256=5S0tVP1HqU2VniFmfTWISJfUHkJSKlww_cilBwWm-uU,1430687
|
|
20
|
+
logler/web/tailwind.config.cjs,sha256=aDOQf-5Fq4l73hN4BgkkjRMbR9EF2toT2rhW2Z5a_Mo,130
|
|
21
|
+
logler/web/templates/index.html,sha256=ymQIQDQGctv3tuW6ig7mIoQRjtbed5Den0xxeF72RVI,77047
|
|
22
|
+
logler-1.0.7.dist-info/METADATA,sha256=07N_AgpYnPpC5eGFSjD9E4rKOinix6Xmj56pRkTaN0U,20835
|
|
23
|
+
logler-1.0.7.dist-info/WHEEL,sha256=SiPkLBTq3cmljVvmmX436EIwFaw9NwO72ZFKdJU8dek,105
|
|
24
|
+
logler-1.0.7.dist-info/entry_points.txt,sha256=KAtycgnrhm85NgD_TCx2QslE9oClYHWKPM9NG598RNs,41
|
|
25
|
+
logler-1.0.7.dist-info/licenses/LICENSE,sha256=SaPvdtwQLl1BA-6s4Exl0M3X7L_6gcnOGzBD86t7dIo,1061
|
|
26
|
+
logler_rs/__init__.py,sha256=y2ULUqMIhS92vwz6utTdkCn5l_T1Kso3YLGqCIZUxKY,119
|
|
27
|
+
logler_rs/logler_rs.cpython-311-darwin.so,sha256=wOjII6-J24t9p3SDr0AlNUNvziwB4P_E3gLW4uc_iTo,38493712
|
|
28
|
+
logler-1.0.7.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Gabu
|
|
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.
|
logler_rs/__init__.py
ADDED
|
Binary file
|