Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions formats/vercel-stream.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Vercel Stream Format (Single JSON Objects per Line)
# This format handles Vercel's streaming format where each line is a JSON object
# containing labels and the log message, severity (level) and timestamp.
#
# Example log lines from vercelclisample.json generate using Vercel CLI like "vercel logs [deployment_url|deployment_id] -j" for JSON format:
# {"level":"error","message":"actual log message","messageTruncated":false,"rowId":"1758639354881","source":"edge-function","timestampInMs":1758639354881,"requestMethod":"GET","requestPath":"/api/noise","domain":"vercel-gonzo-logs-demo-4xufftd83-jon-reeves-projects.vercel.app","responseStatusCode":-1}
# Ensure this file is in ~/.config/gonzo/formats/ and use via "vercel logs [deployment_url|deployment_id] -j | gonzo --format=vercel-stream.yaml"

# Structure:
# - labels: ALL fields (other than "level", "message" and "timestampInMs" are automatically extracted as attributes)
# - message: The actual log message
# - timestamp(timestampInMs): When the log was generated (Unix ms / epoch format)

name: vercel-stream
description: Vercel log stream format with automatic labels extraction
author: Gonzo Community
type: json # 'json' type for JSON-structured logs

# No json.fields mapping - use the raw JSON structure
# This preserves all the original fields for direct access

mapping:
# Extract and parse the timestamp
timestamp:
field: timestampInMs
time_format: unix_ms # Vercel uses Unix ms / epoch format

# The 'message' field contains the actual log message
body:
field: message

# Extract severity from "level"
severity:
field: level # First try level
transform: uppercase # Normalize to uppercase
default: INFO # Default to INFO if not present

# Auto-map all unmapped fields as attributes
auto_map_remaining: true

# Attributes are automatically extracted from the labels object
# All fields in labels.* will become attributes
# You can still explicitly map specific fields if you need transforms
attributes:
# Example of explicit mapping with transform (optional)
# Most fields will be auto-extracted from labels
http_status_severity:
field: responseStatusCode
transform: status_to_severity
25 changes: 25 additions & 0 deletions test-data/vercelclisample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{"level":"info","message":"[noise] {\"ts\":\"2025-09-23T14:55:43.026Z\",\"level\":\"debug\",\"service\":\"orders\",\"msg\":\"validated payload\",\"reqId\":\"p8az76lx\",\"value\":65}","messageTruncated":false,"rowId":"1758639343031","source":"edge-function","timestampInMs":1758639343031,"requestMethod":"GET","requestPath":"/api/noise","domain":"vercel-gonzo-logs-demo-4xufftd83-jon-reeves-projects.vercel.app","responseStatusCode":-1}
{"level":"warning","message":"[noise] {\"ts\":\"2025-09-23T14:55:43.027Z\",\"level\":\"warn\",\"service\":\"checkout\",\"msg\":\"validated payload\",\"reqId\":\"t43ih5uv\",\"value\":936}","messageTruncated":false,"rowId":"1758639343032","source":"edge-function","timestampInMs":1758639343032,"requestMethod":"GET","requestPath":"/api/noise","domain":"vercel-gonzo-logs-demo-4xufftd83-jon-reeves-projects.vercel.app","responseStatusCode":-1}
{"level":"error","message":"[noise] {\"ts\":\"2025-09-23T14:55:45.871Z\",\"level\":\"error\",\"service\":\"payments\",\"msg\":\"DB roundtrip\",\"reqId\":\"xe0ym5su\",\"value\":122}","messageTruncated":false,"rowId":"1758639345872","source":"edge-function","timestampInMs":1758639345872,"requestMethod":"GET","requestPath":"/api/noise","domain":"vercel-gonzo-logs-demo-4xufftd83-jon-reeves-projects.vercel.app","responseStatusCode":-1}
{"level":"info","message":"[noise] {\"ts\":\"2025-09-23T14:55:45.871Z\",\"level\":\"info\",\"service\":\"search\",\"msg\":\"cache miss\",\"reqId\":\"4elsewf1\",\"value\":589}","messageTruncated":false,"rowId":"1758639345873","source":"edge-function","timestampInMs":1758639345873,"requestMethod":"GET","requestPath":"/api/noise","domain":"vercel-gonzo-logs-demo-4xufftd83-jon-reeves-projects.vercel.app","responseStatusCode":-1}
{"level":"error","message":"[noise] {\"ts\":\"2025-09-23T14:55:45.871Z\",\"level\":\"error\",\"service\":\"orders\",\"msg\":\"user not authorized\",\"reqId\":\"nhzuzj1d\",\"value\":281}","messageTruncated":false,"rowId":"1758639345875","source":"edge-function","timestampInMs":1758639345875,"requestMethod":"GET","requestPath":"/api/noise","domain":"vercel-gonzo-logs-demo-4xufftd83-jon-reeves-projects.vercel.app","responseStatusCode":-1}
{"level":"error","message":"[noise] {\"ts\":\"2025-09-23T14:55:45.871Z\",\"level\":\"error\",\"service\":\"orders\",\"msg\":\"user not authorized\",\"reqId\":\"nhzuzj1d\",\"value\":281}","messageTruncated":false,"rowId":"1758639345875","source":"edge-function","timestampInMs":1758639345875,"requestMethod":"GET","requestPath":"/api/noise","domain":"vercel-gonzo-logs-demo-4xufftd83-jon-reeves-projects.vercel.app","responseStatusCode":-1}
{"level":"error","message":"[noise] {\"ts\":\"2025-09-23T14:55:45.871Z\",\"level\":\"error\",\"service\":\"orders\",\"msg\":\"user not authorized\",\"reqId\":\"nhzuzj1d\",\"value\":281}","messageTruncated":false,"rowId":"1758639345875","source":"edge-function","timestampInMs":1758639345875,"requestMethod":"GET","requestPath":"/api/noise","domain":"vercel-gonzo-logs-demo-4xufftd83-jon-reeves-projects.vercel.app","responseStatusCode":-1}
{"level":"error","message":"[noise] {\"ts\":\"2025-09-23T14:55:46.885Z\",\"level\":\"error\",\"service\":\"checkout\",\"msg\":\"user not authorized\",\"reqId\":\"u4av8ykf\",\"value\":479}","messageTruncated":false,"rowId":"1758639346887","source":"edge-function","timestampInMs":1758639346887,"requestMethod":"GET","requestPath":"/api/noise","domain":"vercel-gonzo-logs-demo-4xufftd83-jon-reeves-projects.vercel.app","responseStatusCode":-1}
{"level":"error","message":"[noise] {\"ts\":\"2025-09-23T14:55:46.885Z\",\"level\":\"error\",\"service\":\"checkout\",\"msg\":\"user not authorized\",\"reqId\":\"qisbo1la\",\"value\":36}","messageTruncated":false,"rowId":"1758639346888","source":"edge-function","timestampInMs":1758639346888,"requestMethod":"GET","requestPath":"/api/noise","domain":"vercel-gonzo-logs-demo-4xufftd83-jon-reeves-projects.vercel.app","responseStatusCode":-1}
{"level":"warning","message":"[noise] {\"ts\":\"2025-09-23T14:55:47.870Z\",\"level\":\"warn\",\"service\":\"search\",\"msg\":\"retrying upstream\",\"reqId\":\"lwcoxt2p\",\"value\":802}","messageTruncated":false,"rowId":"1758639347871","source":"edge-function","timestampInMs":1758639347871,"requestMethod":"GET","requestPath":"/api/noise","domain":"vercel-gonzo-logs-demo-4xufftd83-jon-reeves-projects.vercel.app","responseStatusCode":-1}
{"level":"error","message":"[noise] {\"ts\":\"2025-09-23T14:55:47.870Z\",\"level\":\"error\",\"service\":\"payments\",\"msg\":\"timeout talking to dependency\",\"reqId\":\"v8acmom6\",\"value\":462}","messageTruncated":false,"rowId":"1758639347872","source":"edge-function","timestampInMs":1758639347872,"requestMethod":"GET","requestPath":"/api/noise","domain":"vercel-gonzo-logs-demo-4xufftd83-jon-reeves-projects.vercel.app","responseStatusCode":-1}
{"level":"error","message":"[noise] {\"ts\":\"2025-09-23T14:55:48.880Z\",\"level\":\"error\",\"service\":\"search\",\"msg\":\"processing request\",\"reqId\":\"kjo3hhlu\",\"value\":771}","messageTruncated":false,"rowId":"1758639348882","source":"edge-function","timestampInMs":1758639348882,"requestMethod":"GET","requestPath":"/api/noise","domain":"vercel-gonzo-logs-demo-4xufftd83-jon-reeves-projects.vercel.app","responseStatusCode":-1}
{"level":"warning","message":"[noise] {\"ts\":\"2025-09-23T14:55:48.881Z\",\"level\":\"warn\",\"service\":\"orders\",\"msg\":\"cache miss\",\"reqId\":\"wyhbzr0x\",\"value\":588}","messageTruncated":false,"rowId":"1758639348885","source":"edge-function","timestampInMs":1758639348885,"requestMethod":"GET","requestPath":"/api/noise","domain":"vercel-gonzo-logs-demo-4xufftd83-jon-reeves-projects.vercel.app","responseStatusCode":-1}
{"level":"warning","message":"[noise] {\"ts\":\"2025-09-23T14:55:48.881Z\",\"level\":\"warn\",\"service\":\"orders\",\"msg\":\"cache miss\",\"reqId\":\"wyhbzr0x\",\"value\":588}","messageTruncated":false,"rowId":"1758639348885","source":"edge-function","timestampInMs":1758639348885,"requestMethod":"GET","requestPath":"/api/noise","domain":"vercel-gonzo-logs-demo-4xufftd83-jon-reeves-projects.vercel.app","responseStatusCode":-1}
{"level":"info","message":"[noise] {\"ts\":\"2025-09-23T14:55:49.876Z\",\"level\":\"debug\",\"service\":\"orders\",\"msg\":\"retrying upstream\",\"reqId\":\"2db09kdd\",\"value\":766}","messageTruncated":false,"rowId":"1758639349878","source":"edge-function","timestampInMs":1758639349878,"requestMethod":"GET","requestPath":"/api/noise","domain":"vercel-gonzo-logs-demo-4xufftd83-jon-reeves-projects.vercel.app","responseStatusCode":-1}
{"level":"info","message":"[noise] {\"ts\":\"2025-09-23T14:55:49.876Z\",\"level\":\"debug\",\"service\":\"payments\",\"msg\":\"DB roundtrip\",\"reqId\":\"qohl2swi\",\"value\":52}","messageTruncated":false,"rowId":"1758639349879","source":"edge-function","timestampInMs":1758639349879,"requestMethod":"GET","requestPath":"/api/noise","domain":"vercel-gonzo-logs-demo-4xufftd83-jon-reeves-projects.vercel.app","responseStatusCode":-1}
{"level":"error","message":"[noise] {\"ts\":\"2025-09-23T14:55:49.876Z\",\"level\":\"error\",\"service\":\"auth\",\"msg\":\"processing request\",\"reqId\":\"ilnpnvrj\",\"value\":367}","messageTruncated":false,"rowId":"1758639349880","source":"edge-function","timestampInMs":1758639349880,"requestMethod":"GET","requestPath":"/api/noise","domain":"vercel-gonzo-logs-demo-4xufftd83-jon-reeves-projects.vercel.app","responseStatusCode":-1}
{"level":"warning","message":"[noise] {\"ts\":\"2025-09-23T14:55:53.884Z\",\"level\":\"warn\",\"service\":\"checkout\",\"msg\":\"user not authorized\",\"reqId\":\"mmttqrxf\",\"value\":797}","messageTruncated":false,"rowId":"1758639353889","source":"edge-function","timestampInMs":1758639353889,"requestMethod":"GET","requestPath":"/api/noise","domain":"vercel-gonzo-logs-demo-4xufftd83-jon-reeves-projects.vercel.app","responseStatusCode":-1}
{"level":"warning","message":"[noise] {\"ts\":\"2025-09-23T14:55:53.884Z\",\"level\":\"warn\",\"service\":\"checkout\",\"msg\":\"user not authorized\",\"reqId\":\"mmttqrxf\",\"value\":797}","messageTruncated":false,"rowId":"1758639353889","source":"edge-function","timestampInMs":1758639353889,"requestMethod":"GET","requestPath":"/api/noise","domain":"vercel-gonzo-logs-demo-4xufftd83-jon-reeves-projects.vercel.app","responseStatusCode":-1}
{"level":"error","message":"[noise] {\"ts\":\"2025-09-23T14:55:54.879Z\",\"level\":\"error\",\"service\":\"search\",\"msg\":\"validated payload\",\"reqId\":\"xttk3vh1\",\"value\":672}","messageTruncated":false,"rowId":"1758639354881","source":"edge-function","timestampInMs":1758639354881,"requestMethod":"GET","requestPath":"/api/noise","domain":"vercel-gonzo-logs-demo-4xufftd83-jon-reeves-projects.vercel.app","responseStatusCode":-1}
{"level":"warning","message":"[noise] {\"ts\":\"2025-09-23T14:55:55.879Z\",\"level\":\"warn\",\"service\":\"auth\",\"msg\":\"validated payload\",\"reqId\":\"1nkor85z\",\"value\":697}","messageTruncated":false,"rowId":"1758639355881","source":"edge-function","timestampInMs":1758639355881,"requestMethod":"GET","requestPath":"/api/noise","domain":"vercel-gonzo-logs-demo-4xufftd83-jon-reeves-projects.vercel.app","responseStatusCode":-1}
{"level":"info","message":"[noise] {\"ts\":\"2025-09-23T14:55:56.898Z\",\"level\":\"info\",\"service\":\"search\",\"msg\":\"validated payload\",\"reqId\":\"mdv8ntee\",\"value\":24}","messageTruncated":false,"rowId":"1758639356899","source":"edge-function","timestampInMs":1758639356899,"requestMethod":"GET","requestPath":"/api/noise","domain":"vercel-gonzo-logs-demo-4xufftd83-jon-reeves-projects.vercel.app","responseStatusCode":-1}
{"level":"info","message":"[noise] {\"ts\":\"2025-09-23T14:55:56.898Z\",\"level\":\"info\",\"service\":\"payments\",\"msg\":\"user not authorized\",\"reqId\":\"xnz72ol5\",\"value\":979}","messageTruncated":false,"rowId":"1758639356900","source":"edge-function","timestampInMs":1758639356900,"requestMethod":"GET","requestPath":"/api/noise","domain":"vercel-gonzo-logs-demo-4xufftd83-jon-reeves-projects.vercel.app","responseStatusCode":-1}
{"level":"error","message":"[noise] {\"ts\":\"2025-09-23T14:55:56.898Z\",\"level\":\"error\",\"service\":\"auth\",\"msg\":\"validated payload\",\"reqId\":\"wn6r3lph\",\"value\":817}","messageTruncated":false,"rowId":"1758639356901","source":"edge-function","timestampInMs":1758639356901,"requestMethod":"GET","requestPath":"/api/noise","domain":"vercel-gonzo-logs-demo-4xufftd83-jon-reeves-projects.vercel.app","responseStatusCode":-1}
{"level":"error","message":"[noise] {\"ts\":\"2025-09-23T14:55:56.898Z\",\"level\":\"error\",\"service\":\"auth\",\"msg\":\"validated payload\",\"reqId\":\"wn6r3lph\",\"value\":817}","messageTruncated":false,"rowId":"1758639356901","source":"edge-function","timestampInMs":1758639356901,"requestMethod":"GET","requestPath":"/api/noise","domain":"vercel-gonzo-logs-demo-4xufftd83-jon-reeves-projects.vercel.app","responseStatusCode":-1}
Loading