Expand description
Splunk HTTP Event Collector (HEC) compatible ingestion endpoint.
Clients point their base endpoint at /v1/splunk, so the full paths are e.g.
/v1/splunk/services/collector/event and /v1/splunk/services/collector/health.
StructsΒ§
- Splunk
RawQuery Params - Query parameters for
/services/collector/raw.channelis accepted but ignored until indexer acknowledgment lands.table,pipeline_name,version, andlinebreakerare Greptime extensions (linebreakeropts into event breaking; without it the body is one event).
ConstantsΒ§
- DEFAULT_
SPLUNK_ πTABLE - Default table used when neither the eventβs
indexnor a?table=query param is provided. - HEC_
HEALTHY_ πCODE - HEC response code for a healthy collector. Splunk returns
{"text":"HEC is healthy","code":17}. - RAW_
MESSAGE_ πCOLUMN - Column holding the verbatim raw body on
/raw(Splunkβs_raw). Namedmessageto avoid clashing with/eventβseventcolumn (whose shape varies by client: string vs identity-flattened object).
FunctionsΒ§
- apply_
tag_ πcolumns - Retags
Fieldcolumns toTagper table (identity makes everything a Field) so the insert path adds them to the primary key. Tags are scoped by table name so a batch targeting multiple tables canβt cross-promote a same-named field. Identity-only: rebuilds under the default opt. - handle_
event POST /services/collector/event(+/services/collector,/event/1.0aliases). Parses HEC events, runs them through the pipeline (identity default, overridable), and inserts with metadata columns as tags.- handle_
health GET /services/collector/health(+/1.0). Public (seePUBLIC_API_PREFIX), since clients probe it before sending.ack/tokenquery params are ignored.- handle_
raw POST /services/collector/raw(+/raw/1.0alias). By default, the whole body is raw text stored verbatim as ONE event in theRAW_MESSAGE_COLUMNβ multiline payloads (e.g. stack traces) are preserved intact. Explicit framing is opt-in via?linebreaker=(seesplit_raw_body). Metadata comes from query params and applies to every event.channel(param orx-splunk-request-channelheader) is accepted but ignored until indexer acknowledgment lands;- hec_
event_ πto_ map - Maps one HEC event to
(table, per-event map, tag names):time->timestamp,index->table, host/source/sourcetype/fields->tags,event+rest->data.Noneif the event isnβt a JSON object. - hec_
response π - HEC response body
{"text", "code"}; clients branch oncode. - ingest_
events π - Like
ingest_logs_inner, but retags metadata columns (identity default) before insert. - is_
blank_ πevent - A HEC
eventvalue is blank if itβsnullor an empty/whitespace-only string. - is_
splunk_ πrequest - parse_
hec_ πevents - Parses a HEC body into a flat list of events. Handles both batch forms: objects concatenated with any/no separator, and a top-level array (flattened).
- parse_
hec_ πtime - HEC
time: epoch seconds (optionally fractional); values past ~1e12 are read as milliseconds.Noneif absent/unparseable (caller falls back to ingest time). - raw_
event_ πto_ map - Maps one raw event to a per-event map:
{ greptime_timestamp: ts, message: <event>, <metadata columns> }. The event text is stored as it is. - raw_
metadata π - Collects request-level
/rawmetadata (host/source/sourcetype) present in the query params. The keys double as the tag-column names; values apply to every event in the request (HEC/rawmetadata is request-level, unlike/event). - resolve_
pipeline_ πand_ ingest - Shared tail of
/eventand/raw: resolves the pipeline (identity default; overridable via param/header, with an optional?version=pin), enables tag promotion + metadata-first primary-key ordering for the identity path only, runs the ingest, and maps the outcome to a HEC response. - sanitize_
index π - Coerces a Splunk
indexinto a valid table name (NAME_PATTERN);Noneif empty. - split_
raw_ πbody - Splits a raw body into events. Without
?linebreaker=, the whole body is ONE event. With?linebreaker=<literal>(percent-encoded, e.g.%0Afor\n), the body is split on that literal delimiter; whitespace-only segments are dropped, segment content is kept verbatim. - validate_
event π eventmissing -> 12,eventblank -> 13. present, non-null but unparsabletime-> 6.