@ananotherdeveloper/drain3js 0.9.11-rev1 → 0.9.11
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.
- package/README.md +7 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
TypeScript port of [Drain3](https://github.com/logpai/Drain3) - a persistent and streaming log template miner that uses a fixed-depth parse tree.
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/drain3js)
|
|
6
6
|
[](https://github.com/ananotherdeveloper/drain3js/actions/workflows/ci.yml)
|
|
7
7
|
[](https://opensource.org/licenses/MIT)
|
|
8
8
|
|
|
@@ -29,13 +29,13 @@ Based on the paper: *"Drain: An Online Log Parsing Approach with Fixed Depth Tre
|
|
|
29
29
|
## Installation
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
|
-
npm install
|
|
32
|
+
npm install drain3js
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
## Quick Start
|
|
36
36
|
|
|
37
37
|
```typescript
|
|
38
|
-
import { TemplateMiner, TemplateMinerConfig } from '
|
|
38
|
+
import { TemplateMiner, TemplateMinerConfig } from 'drain3js';
|
|
39
39
|
|
|
40
40
|
const config = new TemplateMinerConfig();
|
|
41
41
|
const miner = new TemplateMiner(null, config);
|
|
@@ -68,7 +68,7 @@ for (const log of logs) {
|
|
|
68
68
|
Use `TemplateMinerConfig` to customize behavior:
|
|
69
69
|
|
|
70
70
|
```typescript
|
|
71
|
-
import { TemplateMinerConfig } from '
|
|
71
|
+
import { TemplateMinerConfig } from 'drain3js';
|
|
72
72
|
|
|
73
73
|
const config = new TemplateMinerConfig();
|
|
74
74
|
|
|
@@ -112,7 +112,7 @@ config.load('/path/to/config.json');
|
|
|
112
112
|
Save and restore miner state using persistence handlers:
|
|
113
113
|
|
|
114
114
|
```typescript
|
|
115
|
-
import { TemplateMiner, TemplateMinerConfig, FilePersistence } from '
|
|
115
|
+
import { TemplateMiner, TemplateMinerConfig, FilePersistence } from 'drain3js';
|
|
116
116
|
|
|
117
117
|
const persistence = new FilePersistence('./drain3_state.bin');
|
|
118
118
|
const config = new TemplateMinerConfig();
|
|
@@ -132,7 +132,7 @@ Built-in persistence handlers:
|
|
|
132
132
|
Implement the `PersistenceHandler` interface for custom storage (Redis, S3, etc.):
|
|
133
133
|
|
|
134
134
|
```typescript
|
|
135
|
-
import { PersistenceHandler } from '
|
|
135
|
+
import { PersistenceHandler } from 'drain3js';
|
|
136
136
|
|
|
137
137
|
class RedisPersistence implements PersistenceHandler {
|
|
138
138
|
saveState(state: Buffer): void { /* ... */ }
|
|
@@ -218,7 +218,7 @@ The `match()` method supports three search strategies:
|
|
|
218
218
|
Use `Drain` or `JaccardDrain` directly for advanced use cases:
|
|
219
219
|
|
|
220
220
|
```typescript
|
|
221
|
-
import { Drain } from '
|
|
221
|
+
import { Drain } from 'drain3js';
|
|
222
222
|
|
|
223
223
|
const drain = new Drain(4, 0.4, 100);
|
|
224
224
|
const [cluster, changeType] = drain.addLogMessage('Connected to 10.0.0.1');
|