Skip to content

Commit ad01bd5

Browse files
authored
add logrotate out plugin (#2)
* add logrotate out plugin * fix gzip * fix test * update max_size * update gzip * add logs
1 parent fb0b394 commit ad01bd5

File tree

8 files changed

+1710
-0
lines changed

8 files changed

+1710
-0
lines changed

cmake/plugins_options.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ DEFINE_OPTION(FLB_OUT_DATADOG "Enable DataDog output plugin"
117117
DEFINE_OPTION(FLB_OUT_ES "Enable Elasticsearch output plugin" ON)
118118
DEFINE_OPTION(FLB_OUT_EXIT "Enable Exit output plugin" ON)
119119
DEFINE_OPTION(FLB_OUT_FILE "Enable file output plugin" ON)
120+
DEFINE_OPTION(FLB_OUT_LOGROTATE "Enable logrotate output plugin" ON)
120121
DEFINE_OPTION(FLB_OUT_FLOWCOUNTER "Enable flowcount output plugin" ON)
121122
DEFINE_OPTION(FLB_OUT_FORWARD "Enable Forward output plugin" ON)
122123
DEFINE_OPTION(FLB_OUT_GELF "Enable GELF output plugin" ON)

conf/fluent-bit-logrotate.conf

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[SERVICE]
2+
Flush 1
3+
Log_Level info
4+
Parsers_File parsers.conf
5+
6+
[INPUT]
7+
Name dummy
8+
Tag test.logrotate
9+
Dummy {"message": "test log message", "level": "info"}
10+
Rate 10
11+
12+
[OUTPUT]
13+
Name logrotate
14+
Match test.logrotate
15+
Path /tmp/logs
16+
File test.log
17+
Format json
18+
Max_Size 10
19+
Max_Files 5
20+
Gzip On
21+
Mkdir On

plugins/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,11 @@ REGISTER_OUT_PLUGIN("out_datadog")
363363
REGISTER_OUT_PLUGIN("out_es")
364364
REGISTER_OUT_PLUGIN("out_exit")
365365
REGISTER_OUT_PLUGIN("out_file")
366+
367+
if(FLB_OUT_LOGROTATE)
368+
REGISTER_OUT_PLUGIN("out_logrotate")
369+
endif()
370+
366371
REGISTER_OUT_PLUGIN("out_forward")
367372
REGISTER_OUT_PLUGIN("out_http")
368373
REGISTER_OUT_PLUGIN("out_influxdb")
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
set(src
2+
logrotate.c)
3+
4+
FLB_PLUGIN(out_logrotate "${src}" "")

0 commit comments

Comments
 (0)