Skip to content

Commit a6fce82

Browse files
committed
switch added reflecting blog post
1 parent 495327e commit a6fce82

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

extras/fluentbit/lua-multi-event/advanced.lua

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,21 @@ function copy(obj)
2222
end
2323

2424
function cb_advanced(tag, timestamp, record)
25+
local deepCopy = true
26+
-- flag to control whether or not to perform a deep copy
2527
local code = 1
2628
print("Lua script - ", tag, " ", timestamp, " record is a", type(record))
2729
-- printDetails(record, "")
28-
record1 = copy(record)
29-
record2 = copy(record)
30+
31+
record1 = record
32+
record2 = record
33+
if (deepCopy) then
34+
print("applying deep copy")
35+
record1 = copy(record)
36+
record2 = copy(record)
37+
end
38+
39+
-- modify the records slightly so we can easily distinguish them
3040
record2["BLAHH"] = "piiiinnnnnnnggggggggg"
3141
record1["remoteuser"] = "another user"
3242
newRecord = { record1, record2 }

0 commit comments

Comments
 (0)