GCP Logging Output
Maps the Heka protobuf message to a LogEntry and then delivers it to Stackdriver.
1. Sample Configuration
filename = "gcp_logging.lua"
message_matcher = "Logger == 'input.nginx_access'"
ticker_interval = 1 -- this should be zero when batch_size == 1 and max_async_requests == 0
channel = "logging.googleapis.com"
project = "projects/mozilla-data-poc-198117"
log_id_default = "default"
-- log_id_field = "Type" -- optional field to extract the log_id from, if nil the default is used
max_async_requests = 20 -- default (0 synchronous only)
batch_size = 1000 -- default/maximum
async_buffer_size = max_async_requests * batch_size
-- explicit mapping; Heka message to LogEntry
log_entry_map = {
-- logName = -- if not specified it is constructed from the project and log_id configuration
-- resource = {} -- if not specified it defaults to the gce_instance metadata
timestamp = "Timestamp",
severity = "Severity",
insertId = "Uuid",
labels = {
Hostname = "Hostname",
bodyBytesSent = "Fields[body_bytes_sent]",
request = "Fields[request]",
remoteUser = "Fields[remote_user]",
type = "nginx", -- treated as a literal
},
httpRequest = {
remoteIp = "Fields[remote_addr]",
userAgent = "Fields[http_user_agent]",
status = "Fields[status]",
referer = "Fields[referer]",
},
textPayload = read_message("Payload")
}
source code: gcp_logging.lua