summaryrefslogtreecommitdiffstats
path: root/fluent-bit/scripts/override_time.lua
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 02:57:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 02:57:58 +0000
commitbe1c7e50e1e8809ea56f2c9d472eccd8ffd73a97 (patch)
tree9754ff1ca740f6346cf8483ec915d4054bc5da2d /fluent-bit/scripts/override_time.lua
parentInitial commit. (diff)
downloadnetdata-upstream.tar.xz
netdata-upstream.zip
Adding upstream version 1.44.3.upstream/1.44.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'fluent-bit/scripts/override_time.lua')
-rw-r--r--fluent-bit/scripts/override_time.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/fluent-bit/scripts/override_time.lua b/fluent-bit/scripts/override_time.lua
new file mode 100644
index 00000000..a8f42b15
--- /dev/null
+++ b/fluent-bit/scripts/override_time.lua
@@ -0,0 +1,23 @@
+--[[
+ This Lua script is to override timestamp with integer/float epoch time.
+ https://github.com/fluent/fluent-bit/issues/662
+
+ sample input is
+ [XXXXX.XXXXX, {"KEY_OF_TIMESTAMP"=>1530239065.807368, "data"=>"sample"}]
+
+ expected output is
+ [1530239065.807368040, {"KEY_OF_TIMESTAMP"=>1530239065.807368, "data"=>"sample"}]
+
+
+ sample configuration:
+ [FILTER]
+ Name lua
+ Match *.*
+ script override_time.lua
+ call override_time
+]]
+
+function override_time(tag, timestamp, record)
+ -- modify KEY_OF_TIMESTAMP properly.
+ return 1, record["KEY_OF_TIMESTAMP"], record
+end \ No newline at end of file