[transforms.lua_v2_log] inputs = [] type = "lua" version = "2" hooks.process = """ function (event, emit) event.log.a, event.log.b = nil, event.log.a emit(event) end """ [[tests]] name = "lua_v2_log" [tests.input] insert_at = "lua_v2_log" type = "log" [tests.input.log_fields] a = "example value" [[tests.outputs]] extract_from = "lua_v2_log" [[tests.outputs.conditions]] type = "vrl" source = ''' !exists(.a) && .b == "example value" ''' [transforms.lua_v2_source] inputs = [] type = "lua" version = "2" source = """ function hook_process (event, emit) event.log.inserted_field = "inserted value" emit(event) end """ hooks.process = "hook_process" [[tests]] name = "lua_v2_source" [tests.input] insert_at = "lua_v2_source" type = "log" [tests.input.log_fields] some_field = "some value" [[tests.outputs]] extract_from = "lua_v2_source" [[tests.outputs.conditions]] type = "vrl" source = ''' .some_field == "some value" && .inserted_field == "inserted value" ''' [transforms.lua_v2_metric] inputs = [] type = "lua" version = "2" hooks.process = """ function (event, emit) event.metric.counter.value = event.metric.counter.value + 1 emit(event) end """ [[tests]] name = "lua_v2_metric" [tests.input] insert_at = "lua_v2_metric" type = "metric" [tests.input.metric] name = "example counter" kind = "absolute" counter.value = 1.0 [[tests.outputs]] extract_from = "lua_v2_metric" [[tests.outputs.conditions]] type = "is_metric" [transforms.lua_v2_log_to_metric] inputs = [] type = "lua" version = "2" hooks.process = """ function (event, emit) event.log = nil event.metric = { name = "example metric", counter = { value = 1.0 } } emit(event) end """ [[tests]] name = "lua_v2_log_to_metric" [tests.input] insert_at = "lua_v2_log_to_metric" type = "log" [tests.input.log_fields] a = "example value" [[tests.outputs]] extract_from = "lua_v2_log_to_metric" [[tests.outputs.conditions]] type = "is_metric" [transforms.lua_v2_metric_to_log] inputs = [] type = "lua" version = "2" hooks.process = """ function (event, emit) event.metric = nil event.log = { field = "example value" } emit(event) end """ [[tests]] name = "lua_v2_metric_to_log" [tests.input] insert_at = "lua_v2_metric_to_log" type = "metric" [tests.input.metric] name = "example metric" kind = "absolute" counter.value = 1.0 [[tests.outputs]] extract_from = "lua_v2_metric_to_log" [[tests.outputs.conditions]] type = "vrl" source = ''' .field == "example value" '''