Skip to content

Commit

Permalink
Merge 4729895 into 018e1b5
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecIsaacson committed Sep 17, 2020
2 parents 018e1b5 + 4729895 commit d5d2b73
Show file tree
Hide file tree
Showing 13 changed files with 2,966 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/integrations/v4/logs/cfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ type FBCfgInput struct {
DB string
Path string // plugin: tail
BufferMaxSize string // plugin: tail
PathKey string // plugin: tail
SkipLongLines string // always on
Systemd_Filter string // plugin: systemd
Channels string // plugin: winlog
Expand Down Expand Up @@ -481,6 +482,7 @@ func newFBExternalConfig(l LogExternalFBCfg) FBCfgExternal {
func newFileInput(filePath string, dbPath string, tag string, bufSize int) FBCfgInput {
return FBCfgInput{
Name: fbInputTypeTail,
PathKey: "filePath",
Path: filePath,
DB: dbPath,
Tag: tag,
Expand Down
3 changes: 3 additions & 0 deletions pkg/integrations/v4/logs/cfg_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ var fbConfigFormat = `{{- range .Inputs }}
{{- if .SkipLongLines }}
Skip_Long_Lines {{ .SkipLongLines }}
{{- end }}
{{- if .PathKey }}
Path_Key {{ .PathKey }}
{{- end }}
{{- if .Tag }}
Tag {{ .Tag }}
{{- end }}
Expand Down
9 changes: 9 additions & 0 deletions pkg/integrations/v4/logs/cfg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func TestNewFBConf(t *testing.T) {
Path: "file.path",
BufferMaxSize: "128k",
SkipLongLines: "On",
PathKey: "filePath",
},
},
Parsers: []FBCfgParser{
Expand All @@ -104,6 +105,7 @@ func TestNewFBConf(t *testing.T) {
Path: "file.path",
BufferMaxSize: "128k",
SkipLongLines: "On",
PathKey: "filePath",
},
},
Parsers: []FBCfgParser{
Expand Down Expand Up @@ -160,6 +162,7 @@ func TestNewFBConf(t *testing.T) {
Path: filepath.Join("/path/to/folder", "*"),
BufferMaxSize: "32k",
SkipLongLines: "On",
PathKey: "filePath",
},
},
Parsers: []FBCfgParser{
Expand Down Expand Up @@ -212,6 +215,7 @@ func TestNewFBConf(t *testing.T) {
Path: "/foo/file.foo",
BufferMaxSize: "128k",
SkipLongLines: "On",
PathKey: "filePath",
},
},
Parsers: []FBCfgParser{
Expand Down Expand Up @@ -246,6 +250,7 @@ func TestNewFBConf(t *testing.T) {
Path: "/foo/file.foo",
BufferMaxSize: "128k",
SkipLongLines: "On",
PathKey: "filePath",
},
},
Parsers: []FBCfgParser{
Expand Down Expand Up @@ -749,6 +754,7 @@ func TestFBCfgFormat(t *testing.T) {
Path /path/to/folder/*
Buffer_Max_Size 32k
Skip_Long_Lines On
Path_Key filePath
Tag some-folder
DB fb.db
Expand Down Expand Up @@ -844,6 +850,7 @@ func TestFBCfgFormat(t *testing.T) {
Path: "/path/to/folder/*",
BufferMaxSize: "32k",
SkipLongLines: "On",
PathKey: "filePath",
},
{
Name: "systemd",
Expand Down Expand Up @@ -980,6 +987,7 @@ func TestFBCfgFormatWithHostname(t *testing.T) {
Path file.foo
Buffer_Max_Size 32k
Skip_Long_Lines On
Path_Key filePath
Tag some-file
DB fb.db
Expand Down Expand Up @@ -1029,6 +1037,7 @@ func TestFBCfgFormatWithHostname(t *testing.T) {
Path: "file.foo",
BufferMaxSize: "32k",
SkipLongLines: "On",
PathKey: "filePath",
},
},
Parsers: []FBCfgParser{
Expand Down
2 changes: 2 additions & 0 deletions pkg/integrations/v4/logs/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ logs:
BufferMaxSize: "128k",
DB: dbDbPath,
SkipLongLines: "On",
PathKey: "filePath",
},
},
Parsers: []FBCfgParser{
Expand Down Expand Up @@ -176,6 +177,7 @@ func TestCfgLoader_LoadAll_TroubleshootLogFile(t *testing.T) {
Path: "/agent_log_file",
BufferMaxSize: "128k",
SkipLongLines: "On",
PathKey: "filePath",
Tag: fluentBitTagTroubleshoot,
},
},
Expand Down

0 comments on commit d5d2b73

Please sign in to comment.