Skip to content

Instantly share code, notes, and snippets.

@agup006
Created August 10, 2023 17:08
Show Gist options
  • Save agup006/a02a1c5db2dfe726abcb1610df2d4aec to your computer and use it in GitHub Desktop.
Save agup006/a02a1c5db2dfe726abcb1610df2d4aec to your computer and use it in GitHub Desktop.
Fluent Samples
# This is a sample configuration for Calyptia Fluent Bit
# This reads logs from the server and routes them to standard output
[INPUT]
tag dummy.4aaf0fd6-0f0c-47a3-92b1-7432382f5f3f
Name dummy
rate 1
dummy {"message":"hello world"}
samples 0
start_time_sec -1
start_time_nsec -1
[Filter]
Name lua
Match *
code local a;local function b()if a==nil then local c=io.popen('hostname')a=c:read('*a'):gsub('%s+$','')c:close()end;return a end;function cb_filter(d,e,f)f.hostname=b()return 1,e,f end
call cb_filter
[OUTPUT]
name stdout
format json
Match_Regex .{0,}
# This is a sample configuration for Calyptia Fluent Bit
# This reads logs from the server and routes them to standard output
[INPUT]
tag dummy.4aaf0fd6-0f0c-47a3-92b1-7432382f5f3f
Name dummy
rate 1
dummy {"log":"DEBUG world"}
samples 0
start_time_sec -1
start_time_nsec -1
[INPUT]
tag dummy.4aaf0fd6-0f0c-47a3-92b1-7432382f5f3f
Name dummy
rate 1
dummy {"log":"error world"}
samples 0
start_time_sec -1
start_time_nsec -1
[Filter]
Name lua
Match *
code function cb_filter(a,b,c)local d=c.log:find('^DEBUG')~=nil;local e=c.log:find('^INFO')~=nil;if d or e then return-1 end;return 1,b,c end
call cb_filter
[OUTPUT]
name stdout
format json
Match_Regex .{0,}
# This is a sample configuration for Calyptia Fluent Bit
# This reads logs from the server and routes them to standard output
[INPUT]
tag dummy.4aaf0fd6-0f0c-47a3-92b1-7432382f5f3f
Name dummy
rate 1
dummy {"log":"4123-2345-2133-2144 is my credit card number"}
samples 0
start_time_sec -1
start_time_nsec -1
[Filter]
Name lua
Match *
code function cb_filter(a,b,c)c.log=c.log:gsub('%d%d%d%d','****')return 1,b,c end
call cb_filter
[OUTPUT]
name stdout
format json
Match_Regex .{0,}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment