From 6c280e788666ea57e7a1fb8456ccde1338124cd3 Mon Sep 17 00:00:00 2001 From: Lucas Bremgartner Date: Fri, 22 Oct 2021 20:34:02 +0200 Subject: [PATCH] Add second test case from #147 --- integration_test.go | 3 ++ testdata/issue_147.yml | 2 ++ testdata/issue_147/issue_147.conf | 45 +++++++++++++++++++++++++ testdata/testcases/issue_147/file1.yaml | 19 +++++++++++ testdata/testcases/issue_147/file2.yaml | 20 +++++++++++ 5 files changed, 89 insertions(+) create mode 100644 testdata/issue_147.yml create mode 100644 testdata/issue_147/issue_147.conf create mode 100644 testdata/testcases/issue_147/file1.yaml create mode 100644 testdata/testcases/issue_147/file2.yaml diff --git a/integration_test.go b/integration_test.go index 5b0f204..fdd6f27 100644 --- a/integration_test.go +++ b/integration_test.go @@ -178,6 +178,9 @@ func TestIntegration(t *testing.T) { name: "issue_150", repeat: 5, }, + { + name: "issue_147", + }, } for _, tc := range cases { diff --git a/testdata/issue_147.yml b/testdata/issue_147.yml new file mode 100644 index 0000000..75d1a35 --- /dev/null +++ b/testdata/issue_147.yml @@ -0,0 +1,2 @@ +- pipeline.id: main + path.config: "*.conf" diff --git a/testdata/issue_147/issue_147.conf b/testdata/issue_147/issue_147.conf new file mode 100644 index 0000000..081505c --- /dev/null +++ b/testdata/issue_147/issue_147.conf @@ -0,0 +1,45 @@ +input { + file { + path => "/var/log/db_logs_logstash/*.csv" + mode => "read" + file_completed_action => "delete" + id => "file1" + tags => [ "file1" ] + } +} + +input { + file { + path => "/var/log/db_logs_logstash/*.csv" + mode => "read" + file_completed_action => "delete" + id => "file2" + tags => [ "file2" ] + } +} + +filter { + if "file1" in [tags] { + csv { + separator => ";" + autodetect_column_names => true + skip_empty_columns => true + id => csv1 + } + } + + if "file2" in [tags] { + csv { + separator => ";" + autodetect_column_names => true + skip_empty_columns => true + id => csv2 + } + } +} + +output { + stdout { + id => "stdout" + } +} diff --git a/testdata/testcases/issue_147/file1.yaml b/testdata/testcases/issue_147/file1.yaml new file mode 100644 index 0000000..d9a762a --- /dev/null +++ b/testdata/testcases/issue_147/file1.yaml @@ -0,0 +1,19 @@ +--- +ignore: + - "@timestamp" +testcases: + - input: + - TYP_INST;DBNAME;OS_USERNAME;USERNAME;USERHOST;TERMINAL;LOGON_TIME;LOGOFF_TIME;OS_PROCESS;CLIENT_ID + - Prod;myBeautifulDB;myOS;myUsername;myUserhost;;22/08/2021 14:14:43;22/08/2021 14:14:43;4468; + expected: + - message: "Prod;myBeautifulDB;myOS;myUsername;myUserhost;;22/08/2021 14:14:43;22/08/2021 14:14:43;4468;" + TYP_INST: "Prod" + DBNAME: "myBeautifulDB" + OS_USERNAME: "myOS" + USERNAME: "myUsername" + USERHOST: "myUserhost" + LOGON_TIME: "22/08/2021 14:14:43" + LOGOFF_TIME: "22/08/2021 14:14:43" + OS_PROCESS: "4468" + tags: ["file1"] +input_plugin: file1 diff --git a/testdata/testcases/issue_147/file2.yaml b/testdata/testcases/issue_147/file2.yaml new file mode 100644 index 0000000..ebf7685 --- /dev/null +++ b/testdata/testcases/issue_147/file2.yaml @@ -0,0 +1,20 @@ +--- +ignore: + - "@timestamp" +testcases: + - input: + - | + TYP_INST;DBNAME;OS_USERNAME;USERNAME;USERHOST;TERMINAL;LOGON_TIME;LOGOFF_TIME;OS_PROCESS;CLIENT_ID + Prod;myBeautifulDB;myOS;myUsername;myUserhost;;22/08/2021 14:14:43;22/08/2021 14:14:43;4468; + expected: + - message: "Prod;myBeautifulDB;myOS;myUsername;myUserhost;;22/08/2021 14:14:43;22/08/2021 14:14:43;4468;" + TYP_INST: "Prod" + DBNAME: "myBeautifulDB" + OS_USERNAME: "myOS" + USERNAME: "myUsername" + USERHOST: "myUserhost" + LOGON_TIME: "22/08/2021 14:14:43" + LOGOFF_TIME: "22/08/2021 14:14:43" + OS_PROCESS: "4468" + tags: ["file2"] +input_plugin: file2