Jev Logs
Score OpenTelemetry logs before expensive LLM analysis.
Diagnostic value, priority, and routing with TypeSafe's Jev. Every record stays in your archive.
Website · Guide · llms.txt · npm · Feedback
What Jev Logs does
Health checks and cache hits still hit a reasoning model if you send every event. That costs money before you start investigating.
Jev Logs scores each log first: how useful it is, how urgent it is, and whether it should go to deeper analysis. It uses TypeSafe's Jev through the Vercel AI SDK, with a TypeScript API and an OpenTelemetry exporter wrapper.
| Layer | What you get |
|---|---|
| Score | A 0-100 diagnostic-value score, priority, and actionable probability. |
| Keep the pipeline | Wrap your existing exporter. Resource, scope, timestamps, and trace context stay on the record. |
| Annotate first | Annotation mode keeps every record and attaches jev.* attributes. |
| Route later | Confidently low-value events can skip a separate LLM-analysis branch. |
| Keep uncertain records | Errors, protected records, ambiguity, and provider failures stay eligible for analysis. |
Start a local OpenTelemetry receiver with one config
Requires Node.js 22+. Install with pnpm add jevlogs or npm install jevlogs, or run it without installing through pnpm dlx jevlogs or npx jevlogs. Add jevlogs.config.json at your project root:
{
"envFile": ".env",
"port": 4318,
"retainBelow": 0.1,
"timeoutMs": 2000,
"maxInputChars": 8000
}
Create .env beside it:
AI_GATEWAY_API_KEY=your-vercel-ai-gateway-key
Add .env to your .gitignore. Commit the JSON config, not your key. Create a key in your Vercel AI Gateway dashboard. This is your Gateway key, not an OpenAI key or a Jev Logs account. Provider usage is charged to your Gateway account. The AI SDK reads it server-side to authenticate Jev requests. Applications sending OTLP logs do not need this key. The website never receives it.
Run from that project root:
npx jevlogs@latest --live
The receiver listens at http://127.0.0.1:4318/v1/logs and stays running until Ctrl+C. GET /health checks the receiver, not model availability. It prints one JSON decision per record to stdout, with available trace/span IDs and timestamp. It does not print raw log bodies or store your logs. Keep your existing archive/export pipeline.
The default config is read from your current working directory. Use --config ./config/jevlogs.json for another location; envFile resolves relative to that config. Existing environment variables take precedence over .env. --port 4320 overrides the config port. All settings are optional; you can omit envFile when your shell or secret manager already supplies AI_GATEWAY_API_KEY. Unknown configuration keys fail clearly. Never put an API key directly in the JSON.
| Setting | Default | Meaning |
|---|---|---|
envFile |
None | Local dotenv file to load; explicit missing files fail startup |
port |
4318 |
Local HTTP receiver port |
retainBelow |
0.1 |
Actionable-probability threshold, from 0 through 0.5; low value and low priority are also required to retain |
timeoutMs |
2000 |
Per-record model timeout; failures remain eligible for analysis |
maxInputChars |
8000 |
Maximum serialized model input; oversized input remains eligible for analysis |
forwardUrl |
None | OTLP HTTP/JSON logs endpoint that receives the annotated batch, for example your Collector at http://127.0.0.1:4320/v1/logs |
forwardMode |
annotate |
annotate forwards every record with jev.* attributes; analysis-only forwards only records routed to analysis |
rules |
[] |
Regular expressions tested against the redacted body before any model call; first match wins |
cacheSize |
1000 |
Decisions kept in memory, keyed by a hash of the normalized redacted input; 0 disables the cache |
cacheTtlMs |
300000 |
How long a cached decision stays valid |
normalizeTemplates |
true |
Collapse IPs, UUIDs, timestamps, paths, and long ids in the cache key. The model still sees the redacted original. false caches exact inputs |
maxModelCalls |
None | Stop calling the model after this many invocations. Later analysis records stay eligible with reason: "budget". The pager holds |
suppressForMs |
0 |
With --page, hold repeats of a template that already paged, for up to 24 hours |
Send logs from your application
POST OTLP HTTP to /v1/logs as JSON (application/json) or protobuf (application/x-protobuf). gzip is accepted. gRPC is not supported and returns HTTP 501. Java, Go, Python, and Collector HTTP exporters already default to protobuf, so they do not need OTEL_EXPORTER_OTLP_LOGS_PROTOCOL=http/json.
With the JavaScript JSON exporter:
pnpm add @opentelemetry/sdk-logs @opentelemetry/exporter-logs-otlp-http
# or: npm install @opentelemetry/sdk-logs @opentelemetry/exporter-logs-otlp-http
import { LoggerProvider, BatchLogRecordProcessor } from '@opentelemetry/sdk-logs';
import { OTLPLogExporter } from '@opentelemetry/exporter-logs-otlp-http';
const provider = new LoggerProvider({
processors: [new BatchLogRecordProcessor({
exporter: new OTLPLogExporter({
url: 'http://127.0.0.1:4318/v1/logs',
}),
maxExportBatchSize: 16,
exportTimeoutMillis: 15000,
})],
});
provider.getLogger('my-app').emit({
body: 'GET /health returned 200',
severityNumber: 9,
});
await provider.shutdown(); // Flush once when your application exits.
For other language SDKs, point the logs endpoint at the receiver. Protobuf is the default:
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=http://127.0.0.1:4318/v1/logs
JSON still works if you set OTEL_EXPORTER_OTLP_LOGS_PROTOCOL=http/json. Environment variables configure an installed exporter; they do not instrument your application automatically. Keep batches at 16 records for the default timeouts. The receiver accepts uncompressed or gzip JSON and protobuf, up to 1 MiB and 100 records per request, with four evaluations in flight. Concurrent batches receive HTTP 503 with Retry-After; let a retry-capable exporter handle backpressure. It binds to loopback only. This preview is a local development receiver, not a remote hosted collector.
Embed the same receiver in an npm application
import { startJevLogsServer, loadJevConfig } from 'jevlogs/server';
const server = await startJevLogsServer({
...await loadJevConfig(),
async onLog({ resource, scope, logRecord, decision }) {
// Original OTLP fields are preserved. Connect your own durable sink here.
// decision.route tells you whether deeper LLM analysis is recommended.
console.log(JSON.stringify({ decision, traceId: logRecord.traceId }));
},
});
console.log(server.url);
// During application shutdown: await server.close();
onLog is called for every record, including those marked retain. Redaction applies to model input; the callback receives the original record, so apply your own storage policy. HTTP success acknowledges callback completion, not durable storage. Callback failures return OTLP partial-success counts; compliant clients do not retry rejected records in a partial-success response. Persist within your callback if delivery matters. Retried requests are not deduplicated.
Only the body, severity, and service.name go into model input, after the SDK's redaction. Other resource attributes, scope, and trace IDs stay on the callback record and are not sent. Errors and jev.protected=true records bypass inference. Default redaction is a starting point, not a complete sensitive-data policy.
For a one-time model demonstration instead of starting the receiver, run npx jevlogs --live --sample. File and stdin modes still work as finite batches.
Forward annotated logs to your collector
Point your application at Jev Logs and Jev Logs at the collector you already run. Every record continues on with jev.* attributes attached; nothing is stored in between.
{
"envFile": ".env",
"forwardUrl": "http://127.0.0.1:4320/v1/logs",
"forwardMode": "annotate",
"rules": [
{ "name": "health", "match": "^GET /health", "route": "retain" }
]
}
your app ──OTLP HTTP (JSON or protobuf)──▶ jevlogs :4318 ──annotated OTLP JSON──▶ collector :4320
Forwarding happens before the local decision output, so an upstream failure returns HTTP 503 with Retry-After and your exporter resends the batch. Authentication headers for the upstream come from OTEL_EXPORTER_OTLP_LOGS_HEADERS or OTEL_EXPORTER_OTLP_HEADERS in the receiver's environment, using the standard key=value,key=value syntax. analysis-only mode forwards just the records routed to analysis, which is how you feed a separate LLM-analysis pipeline without touching your archive.
Rules run after protection and redaction and before the cache or the model, so known noise costs nothing. A retain rule produces value: 0, priority: low; an analyze rule produces the conservative fallback. ERROR/FATAL and jev.protected records are never affected by rules. Identical redacted inputs share one model call and are then served from an in-memory cache, marked cached: true. GET /stats reports requests, records, forwarded batches, cache hits, rule hits, model latency and reported input tokens.
What you can build today
| Use case | How to use Jev Logs | What stays in your application |
|---|---|---|
| Triage a batch of application logs | Run the live CLI on a text file or JSONL snapshot. | Log collection, retention, and human investigation. |
| Prioritize an incident-analysis queue | Call triage() before enqueueing expensive reasoning work. |
The queue, retries, and downstream analysis model. |
| Explore signal quality in an OTel backend | Wrap your exporter in annotation mode and inspect jev.* attributes. |
Your exporter, backend queries, alerts, and dashboards. |
| Filter only the LLM analysis branch | Preserve an archive processor and add a separate analysis-only processor. |
Archive delivery and analysis-queue delivery. |
| Keep audit events eligible for analysis | Set protected: true in standalone/CLI input or jev.protected: true in OTel attributes. |
Your policy for deciding which records are protected. |
| Plan an analysis budget | Use estimateSavings() with measured volume and your model prices. |
Actual token metering and billing verification. |
Read the capability and integration guide
The guide includes the full CLI reference, JSONL schema, decision fields, configuration defaults, an archive-plus-analysis pipeline, redaction examples, cost calculation, and troubleshooting. Read the same guide on GitHub.
Try it in one command
npx jevlogs
No setup. No API key. A clearly labeled offline demo walks through four sample logs with fixed answers:
0 / 100 low RETAIN GET /health returned 200 in 2ms
25 / 100 low RETAIN Cache hit for product:482
100 / 100 critical ANALYZE Payment capture failed after three retries
75 / 100 high ANALYZE Database connection pool at 94% capacity
4 logs preserved · 2 selected for analysis · 2 may skip deeper analysis.
Illustrative output. The default demo makes no network requests and does not run Jev inference.
Try real Jev
Set AI_GATEWAY_API_KEY in your environment, then choose your input:
# Evaluate the included sample logs with Jev
npx jevlogs --live --sample
# Evaluate a local log file
npx jevlogs --live --file ./app.log --limit 20
# Pipe JSONL in; get machine-readable decisions out
cat app.jsonl | npx jevlogs --live --stdin --json
# Follow a live stream; each line is evaluated as it arrives
tail -f app.log | npx jevlogs --live --stdin --follow --json
Live mode sends redacted log bodies to Vercel AI Gateway / TypeSafe and incurs provider charges. Your files remain unchanged. Get access through AI Gateway.
CLI input, limits, and exit codes
- Accepts plain text or JSONL with
body/message/msg,severityNumber,severityText/level,service, andprotected. - Pino levels 10, 20, 30, 40, 50, and 60 map to TRACE, DEBUG, INFO, WARN, ERROR, and FATAL.
- Processes 20 records by default, up to 100 with
--limit; total input is capped at 1 MiB. --followstreams stdin line by line with no record limit, four evaluations in flight, and ends at EOF.--jsonemits one decision per line without raw bodies. Headers and summaries go to stderr.- Provider failures conservatively keep records for analysis and exit with code
2. - Usage and input errors exit with code
1. - Run
npx jevlogs --helpfor the complete command reference.
Add it to your application
pnpm add jevlogs
# or: npm install jevlogs
import { createJevLogs } from 'jevlogs';
const jev = createJevLogs();
const decision = await jev.triage({
body: 'Database connection pool at 94% capacity',
severityText: 'WARN',
});
console.log(decision);
// value · priority · route · actionableProbability · reason
Page from a probability
Analysis routing and paging are different decisions. Paging on ERROR, or on a discrete label such as urgency: "page", either misses quiet incidents or wakes people up for expected errors. Ask one boolean question and keep the threshold in your code:
import { createJevPager } from 'jevlogs';
const pager = createJevPager({ pageAbove: 0.5 });
const decision = await pager.decide({
service: 'orders-db',
severityText: 'INFO',
body: 'Replica lag 47m on primary still accepting writes',
});
if (decision.page) console.log(`page p=${decision.probability}`);
decision.page is probability >= pageAbove. ERROR lines are still sent to the model. FATAL, CRITICAL, and protected: true page immediately. A timeout holds (page: false) unless you set pageOnUnavailable: true. suppressForMs holds later copies of a template that already paged, so a crash loop pages once per window. The same policy is available as npx jevlogs --page and npx jevlogs --live --page --file app.log. --page-above accepts 0.05–0.95. The OTLP receiver continues to emit analysis routes.
Score a labeled file before you filter
npx jevlogs --live --file incidents.jsonl --labels --json
Each record can set important: true or label: "incident" when a human needed it, and important: false or label: "noise" when it should be skipped. The summary prints recall and precision. A missed important record exits 2. scoreDecisions() is the same calculation in code. maxModelCalls caps how many of those lines can reach the model; past the cap, analysis routing keeps the record and the pager holds.
Requires Node.js 22+ and a server-side AI_GATEWAY_API_KEY for live evaluation. The standalone API and CLI do not need OpenTelemetry, at runtime or to type-check. Importing the library does not run the CLI. CommonJS code on Node.js 22.12+ can require('jevlogs').
Already using OpenTelemetry?
pnpm add jevlogs @opentelemetry/sdk-logs
# or: npm install jevlogs @opentelemetry/sdk-logs
@opentelemetry/sdk-logs is an optional peer, so pnpm and npm will not install it for you. Any 0.x release from 0.200 on works. The example below uses the current SDK; versions before the { exporter } option take the exporter as the processor's first argument.
Wrap the exporter you already use:
import {
LoggerProvider,
BatchLogRecordProcessor,
ConsoleLogRecordExporter,
} from '@opentelemetry/sdk-logs';
import { JevLogExporter } from 'jevlogs';
const provider = new LoggerProvider({
processors: [
new BatchLogRecordProcessor({
exporter: new JevLogExporter({
exporter: new ConsoleLogRecordExporter(), // or your OTLP exporter
mode: 'annotate', // keeps every log
}),
maxExportBatchSize: 16,
exportTimeoutMillis: 15_000,
}),
],
});
provider.getLogger('app').emit({
body: 'GET /health returned 200',
severityNumber: 9,
});
// Flush during application shutdown, not after each log.
await provider.shutdown();
Annotate first. Route when you are ready. Keep your original archive processor, then add a separate analysis-queue exporter with mode: 'analysis-only'. Annotation alone does not reduce LLM billing; the downstream analysis pipeline must act on the routing decision.
Read the integration guide → · Open the runnable example →
What gets analyzed?
┌─ Existing archive → all logs
OpenTelemetry logs ────────┤
└─ Jev Logs → value + priority + probability
│
┌───────────┴────────────┐
▼ ▼
Deeper analysis Retain in archive
Useful / uncertain Confidently low-value
A log may skip the analysis branch only when all three conditions hold:
- Priority is
low. - Diagnostic value is 25 or below.
- Actionable probability is below 0.1, the default threshold.
ERROR/FATAL records and records marked jev.protected: true always remain eligible for analysis. So do invalid outputs, timeouts, and provider failures. Nothing in this SDK deletes your archive.
Decision fields and tuning
| Field | Meaning |
|---|---|
value |
Five-level diagnostic rubric mapped to 0–100. Not money or confidence. |
priority |
critical, high, normal, or low. |
route |
analyze or retain. |
actionableProbability |
Jev's boolean estimate; null when no model decision is available. |
reason |
model, protected, uncertain, unavailable, or rule. |
cached |
true when served from the local decision cache instead of a new model call. |
rule |
Name of the matching configured rule when reason is rule. |
const jev = createJevLogs({
retainBelow: 0.1, // 0–0.5; 0 disables analysis bypass
timeoutMs: 2000,
maxInputChars: 8000,
rules: [{ name: 'health', match: '^GET /health', route: 'retain' }],
cache: { maxEntries: 1000, ttlMs: 300_000 }, // or false
});
jev.stats(); // decisions, model calls, cache hits, rule hits, latency, input tokens
The exporter defaults to four concurrent requests, configurable from 1–32. Use OTel batches of 16; larger batches may exceed export deadlines. Overlapping exports bypass scoring and forward all records
