logtap 0.4.0__py3-none-any.whl → 0.4.1__py3-none-any.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.
- logtap/api/routes/logs.py +26 -31
- logtap/api/routes/parsed.py +8 -7
- logtap/api/routes/runs.py +9 -30
- logtap/cli/commands/doctor.py +127 -0
- logtap/cli/commands/tail.py +13 -5
- logtap/cli/main.py +2 -1
- logtap/core/runs.py +71 -31
- logtap/core/validation.py +132 -0
- logtap-0.4.1.dist-info/METADATA +304 -0
- {logtap-0.4.0.dist-info → logtap-0.4.1.dist-info}/RECORD +13 -12
- logtap-0.4.0.dist-info/METADATA +0 -319
- {logtap-0.4.0.dist-info → logtap-0.4.1.dist-info}/WHEEL +0 -0
- {logtap-0.4.0.dist-info → logtap-0.4.1.dist-info}/entry_points.txt +0 -0
- {logtap-0.4.0.dist-info → logtap-0.4.1.dist-info}/licenses/LICENSE +0 -0
logtap-0.4.0.dist-info/METADATA
DELETED
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: logtap
|
|
3
|
-
Version: 0.4.0
|
|
4
|
-
Summary: A CLI-first log access tool for Unix systems. Remote log file access without SSH.
|
|
5
|
-
Project-URL: Homepage, https://github.com/cainky/logtap
|
|
6
|
-
Project-URL: Repository, https://github.com/cainky/logtap
|
|
7
|
-
Author-email: cainky <kylecain.me@gmail.com>
|
|
8
|
-
License: GPL-3.0-or-later
|
|
9
|
-
License-File: LICENSE
|
|
10
|
-
Keywords: cli,devops,logs,monitoring,sysadmin
|
|
11
|
-
Classifier: Development Status :: 4 - Beta
|
|
12
|
-
Classifier: Environment :: Console
|
|
13
|
-
Classifier: Intended Audience :: Developers
|
|
14
|
-
Classifier: Intended Audience :: System Administrators
|
|
15
|
-
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
|
16
|
-
Classifier: Operating System :: MacOS
|
|
17
|
-
Classifier: Operating System :: POSIX :: Linux
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
-
Classifier: Topic :: System :: Logging
|
|
22
|
-
Classifier: Topic :: System :: Monitoring
|
|
23
|
-
Classifier: Topic :: System :: Systems Administration
|
|
24
|
-
Requires-Python: >=3.10
|
|
25
|
-
Requires-Dist: aiofiles>=23.2.1
|
|
26
|
-
Requires-Dist: fastapi>=0.109.0
|
|
27
|
-
Requires-Dist: google-re2>=1.1
|
|
28
|
-
Requires-Dist: httpx>=0.26.0
|
|
29
|
-
Requires-Dist: pydantic-settings>=2.1.0
|
|
30
|
-
Requires-Dist: pydantic>=2.5.0
|
|
31
|
-
Requires-Dist: python-dotenv>=1.0.1
|
|
32
|
-
Requires-Dist: rich>=13.7.0
|
|
33
|
-
Requires-Dist: typer>=0.9.0
|
|
34
|
-
Requires-Dist: uvicorn[standard]>=0.27.0
|
|
35
|
-
Requires-Dist: websockets>=12.0
|
|
36
|
-
Provides-Extra: dev
|
|
37
|
-
Requires-Dist: pre-commit>=4.5.1; extra == 'dev'
|
|
38
|
-
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
|
|
39
|
-
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
|
|
40
|
-
Requires-Dist: pytest>=7.4.0; extra == 'dev'
|
|
41
|
-
Requires-Dist: ruff>=0.1.0; extra == 'dev'
|
|
42
|
-
Description-Content-Type: text/markdown
|
|
43
|
-
|
|
44
|
-
# logtap
|
|
45
|
-
|
|
46
|
-
[](https://badge.fury.io/py/logtap)
|
|
47
|
-
[](https://github.com/cainky/logtap/actions/workflows/tests.yml)
|
|
48
|
-
[](https://www.gnu.org/licenses/gpl-3.0)
|
|
49
|
-
[](https://www.python.org/downloads/)
|
|
50
|
-
|
|
51
|
-
**A CLI-first log access tool for Unix systems. Remote log file access without SSH.**
|
|
52
|
-
|
|
53
|
-
> The simplest way to access log files remotely. No database. No complex setup.
|
|
54
|
-
|
|
55
|
-
## Features
|
|
56
|
-
|
|
57
|
-
- **Remote Log Access** - Query log files via REST API without SSH
|
|
58
|
-
- **Beautiful CLI** - Colored output with rich formatting
|
|
59
|
-
- **Regex Search** - Powerful filtering with regex patterns
|
|
60
|
-
- **Real-time Streaming** - Follow logs like `tail -f` (WebSocket)
|
|
61
|
-
- **Lightweight** - No database required, minimal dependencies
|
|
62
|
-
- **Secure** - Optional API key authentication
|
|
63
|
-
- **Docker Ready** - One-command deployment
|
|
64
|
-
|
|
65
|
-
## Quick Start
|
|
66
|
-
|
|
67
|
-
### Installation
|
|
68
|
-
|
|
69
|
-
```bash
|
|
70
|
-
pip install logtap
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
Or with Docker:
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
docker pull cainky/logtap
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### Start the Server
|
|
80
|
-
|
|
81
|
-
On the machine with log files:
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
logtap serve
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
With authentication:
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
logtap serve --api-key your-secret-key
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
### Query Logs
|
|
94
|
-
|
|
95
|
-
From anywhere:
|
|
96
|
-
|
|
97
|
-
```bash
|
|
98
|
-
# Basic query
|
|
99
|
-
logtap query syslog
|
|
100
|
-
|
|
101
|
-
# Search for errors
|
|
102
|
-
logtap query syslog --term "error"
|
|
103
|
-
|
|
104
|
-
# Regex search
|
|
105
|
-
logtap query auth.log --regex "Failed password.*root"
|
|
106
|
-
|
|
107
|
-
# Last 100 lines
|
|
108
|
-
logtap query syslog --limit 100
|
|
109
|
-
|
|
110
|
-
# From a remote server
|
|
111
|
-
logtap query syslog --server http://myserver:8000 --api-key secret
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
### List Available Files
|
|
115
|
-
|
|
116
|
-
```bash
|
|
117
|
-
logtap files
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
### Real-time Streaming
|
|
121
|
-
|
|
122
|
-
```bash
|
|
123
|
-
logtap tail syslog --follow
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
## CLI Commands
|
|
127
|
-
|
|
128
|
-
| Command | Description |
|
|
129
|
-
|---------|-------------|
|
|
130
|
-
| `logtap serve` | Start the API server |
|
|
131
|
-
| `logtap query <file>` | Query log files |
|
|
132
|
-
| `logtap tail <file>` | Tail logs (with `--follow` for streaming) |
|
|
133
|
-
| `logtap files` | List available log files |
|
|
134
|
-
|
|
135
|
-
### Common Options
|
|
136
|
-
|
|
137
|
-
```bash
|
|
138
|
-
# Server options
|
|
139
|
-
logtap serve --host 0.0.0.0 --port 8000
|
|
140
|
-
logtap serve --api-key mysecret --log-dir /var/log
|
|
141
|
-
|
|
142
|
-
# Client options
|
|
143
|
-
logtap query syslog --server http://host:8000 --api-key mysecret
|
|
144
|
-
logtap query syslog --term "error" --limit 50
|
|
145
|
-
logtap query syslog --regex "pattern" --ignore-case
|
|
146
|
-
logtap query syslog --output json # json, plain, pretty
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
## API Reference
|
|
150
|
-
|
|
151
|
-
### GET /logs
|
|
152
|
-
|
|
153
|
-
Query log file contents.
|
|
154
|
-
|
|
155
|
-
**Parameters:**
|
|
156
|
-
| Parameter | Type | Default | Description |
|
|
157
|
-
|-----------|------|---------|-------------|
|
|
158
|
-
| `filename` | string | `syslog` | Log file name |
|
|
159
|
-
| `term` | string | - | Substring to search for |
|
|
160
|
-
| `regex` | string | - | Regex pattern to match |
|
|
161
|
-
| `limit` | int | `50` | Number of lines (1-1000) |
|
|
162
|
-
| `case_sensitive` | bool | `true` | Case-sensitive search |
|
|
163
|
-
|
|
164
|
-
**Example:**
|
|
165
|
-
```bash
|
|
166
|
-
curl "http://localhost:8000/logs?filename=syslog&term=error&limit=10"
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
**Response:**
|
|
170
|
-
```json
|
|
171
|
-
{
|
|
172
|
-
"lines": ["Jan 8 10:23:45 server error: connection failed", "..."],
|
|
173
|
-
"count": 10,
|
|
174
|
-
"filename": "syslog"
|
|
175
|
-
}
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
### GET /files
|
|
179
|
-
|
|
180
|
-
List available log files.
|
|
181
|
-
|
|
182
|
-
```bash
|
|
183
|
-
curl "http://localhost:8000/files"
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
### GET /health
|
|
187
|
-
|
|
188
|
-
Health check endpoint.
|
|
189
|
-
|
|
190
|
-
```bash
|
|
191
|
-
curl "http://localhost:8000/health"
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
### Authentication
|
|
195
|
-
|
|
196
|
-
If `LOGTAP_API_KEY` is set, all requests require the `X-API-Key` header:
|
|
197
|
-
|
|
198
|
-
```bash
|
|
199
|
-
curl -H "X-API-Key: your-secret" "http://localhost:8000/logs"
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
## Configuration
|
|
203
|
-
|
|
204
|
-
### Environment Variables
|
|
205
|
-
|
|
206
|
-
| Variable | Default | Description |
|
|
207
|
-
|----------|---------|-------------|
|
|
208
|
-
| `LOGTAP_HOST` | `0.0.0.0` | Server bind host |
|
|
209
|
-
| `LOGTAP_PORT` | `8000` | Server bind port |
|
|
210
|
-
| `LOGTAP_LOG_DIRECTORY` | `/var/log` | Log files directory |
|
|
211
|
-
| `LOGTAP_API_KEY` | - | API key (optional) |
|
|
212
|
-
|
|
213
|
-
### Using .env File
|
|
214
|
-
|
|
215
|
-
Create a `.env` file:
|
|
216
|
-
|
|
217
|
-
```env
|
|
218
|
-
LOGTAP_LOG_DIRECTORY=/var/log
|
|
219
|
-
LOGTAP_API_KEY=your-secret-key
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
## Docker Deployment
|
|
223
|
-
|
|
224
|
-
### Using Docker Compose
|
|
225
|
-
|
|
226
|
-
```yaml
|
|
227
|
-
version: "3.8"
|
|
228
|
-
|
|
229
|
-
services:
|
|
230
|
-
logtap:
|
|
231
|
-
image: cainky/logtap
|
|
232
|
-
ports:
|
|
233
|
-
- "8000:8000"
|
|
234
|
-
volumes:
|
|
235
|
-
- /var/log:/var/log:ro
|
|
236
|
-
environment:
|
|
237
|
-
- LOGTAP_API_KEY=your-secret-key
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
```bash
|
|
241
|
-
docker-compose up -d
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
### Using Docker Directly
|
|
245
|
-
|
|
246
|
-
```bash
|
|
247
|
-
docker run -d \
|
|
248
|
-
-p 8000:8000 \
|
|
249
|
-
-v /var/log:/var/log:ro \
|
|
250
|
-
-e LOGTAP_API_KEY=your-secret \
|
|
251
|
-
cainky/logtap
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
## Development
|
|
255
|
-
|
|
256
|
-
### Setup
|
|
257
|
-
|
|
258
|
-
```bash
|
|
259
|
-
# Clone the repository
|
|
260
|
-
git clone https://github.com/cainky/logtap.git
|
|
261
|
-
cd logtap
|
|
262
|
-
|
|
263
|
-
# Install dependencies
|
|
264
|
-
poetry install
|
|
265
|
-
|
|
266
|
-
# Run tests
|
|
267
|
-
poetry run pytest
|
|
268
|
-
|
|
269
|
-
# Run the server in development mode
|
|
270
|
-
poetry run logtap serve --reload
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
### Project Structure
|
|
274
|
-
|
|
275
|
-
```
|
|
276
|
-
logtap/
|
|
277
|
-
├── src/logtap/
|
|
278
|
-
│ ├── api/ # FastAPI server
|
|
279
|
-
│ ├── cli/ # Typer CLI commands
|
|
280
|
-
│ ├── core/ # Core business logic
|
|
281
|
-
│ └── models/ # Pydantic models
|
|
282
|
-
├── tests/
|
|
283
|
-
│ ├── unit/ # Unit tests
|
|
284
|
-
│ └── integration/ # API tests
|
|
285
|
-
├── Dockerfile
|
|
286
|
-
└── docker-compose.yml
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
### Running Tests
|
|
290
|
-
|
|
291
|
-
```bash
|
|
292
|
-
# All tests
|
|
293
|
-
poetry run pytest
|
|
294
|
-
|
|
295
|
-
# With coverage
|
|
296
|
-
poetry run pytest --cov=logtap
|
|
297
|
-
|
|
298
|
-
# Specific test file
|
|
299
|
-
poetry run pytest tests/unit/test_reader.py
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
## Security Considerations
|
|
303
|
-
|
|
304
|
-
- **Path Traversal Protection**: Filenames are validated to prevent `../` attacks
|
|
305
|
-
- **Input Validation**: Search terms limited to 100 chars, limits capped at 1000
|
|
306
|
-
- **Read-Only**: Log directory is mounted read-only in Docker
|
|
307
|
-
- **API Authentication**: Optional API key for production use
|
|
308
|
-
|
|
309
|
-
## License
|
|
310
|
-
|
|
311
|
-
GPL v3 License - see [LICENSE](LICENSE) for details.
|
|
312
|
-
|
|
313
|
-
## Contributing
|
|
314
|
-
|
|
315
|
-
Contributions are welcome! Please open an issue to discuss potential changes before submitting a pull request.
|
|
316
|
-
|
|
317
|
-
## Author
|
|
318
|
-
|
|
319
|
-
Kyle Cain - [@cainky](https://github.com/cainky)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|