This directory contains sample Javascript UDFs that can be used to enrich, filter, route, and transform data in Dataflow pipelines.
Adds a new field source
with the value pos
to the incoming JSON event.
Adds fields to a Cloud Logging log entry received from Pub/Sub. Adds inputSubscription
and callingAppId
based on the log entry content.
Filters out incoming JSON events where the severity
field is equal to DEBUG
.
Routes incoming JSON events to the dead-letter queue if they do not have a severity
property. Throws an error with the event ID to trigger dead-letter queue routing.
Transforms fields of incoming JSON events. Normalizes the source
field to lowercase, redacts sensitiveField
to REDACTED
, and removes redundantField
.
Transforms an incoming CSV line into a JSON object. The output JSON object has fields location
, name
, age
, color
, and coffee
, mapped from the corresponding CSV columns.
Transforms Cloud Logging log entries received from Pub/Sub. If the log entry has a textPayload
, it returns the textPayload
as a string. Otherwise, it returns the original JSON object as a string.
Sets Splunk HTTP Event Collector (HEC) metadata for Cloud Logging log entries received from Pub/Sub. Sets the index
, source
, and sourcetype
metadata fields based on the log entry content.