From 7f22cd502ae66c5bd76e4cdd53226b56e4ae4eaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mi=20V=C3=A1nyi?= Date: Mon, 3 Sep 2018 20:27:28 +0200 Subject: [PATCH 1/3] move filebeat/readers to libbeat/readers --- filebeat/input/log/config.go | 4 ++-- filebeat/input/log/harvester.go | 10 +++++----- filebeat/input/log/harvester_test.go | 4 ++-- filebeat/scripts/tester/main.go | 8 ++++---- {filebeat => libbeat}/reader/doc.go | 0 {filebeat => libbeat}/reader/message.go | 0 {filebeat => libbeat}/reader/multiline/multiline.go | 4 ++-- .../reader/multiline/multiline_config.go | 0 .../reader/multiline/multiline_test.go | 0 {filebeat => libbeat}/reader/reader.go | 0 {filebeat => libbeat}/reader/readfile/encode.go | 4 ++-- .../reader/readfile/encoding/encoding.go | 0 .../reader/readfile/encoding/mixed.go | 0 .../reader/readfile/encoding/utf16.go | 0 .../reader/readfile/encoding/utf16_test.go | 0 {filebeat => libbeat}/reader/readfile/limit.go | 2 +- {filebeat => libbeat}/reader/readfile/limit_test.go | 0 {filebeat => libbeat}/reader/readfile/line.go | 0 {filebeat => libbeat}/reader/readfile/line_test.go | 0 {filebeat => libbeat}/reader/readfile/strip_newline.go | 2 +- .../reader/readfile/strip_newline_test.go | 0 {filebeat => libbeat}/reader/readfile/timeout.go | 2 +- {filebeat => libbeat}/reader/readjson/docker_json.go | 2 +- .../reader/readjson/docker_json_test.go | 0 {filebeat => libbeat}/reader/readjson/json.go | 2 +- {filebeat => libbeat}/reader/readjson/json_config.go | 0 {filebeat => libbeat}/reader/readjson/json_test.go | 0 27 files changed, 22 insertions(+), 22 deletions(-) rename {filebeat => libbeat}/reader/doc.go (100%) rename {filebeat => libbeat}/reader/message.go (100%) rename {filebeat => libbeat}/reader/multiline/multiline.go (98%) rename {filebeat => libbeat}/reader/multiline/multiline_config.go (100%) rename {filebeat => libbeat}/reader/multiline/multiline_test.go (100%) rename {filebeat => libbeat}/reader/reader.go (100%) rename {filebeat => libbeat}/reader/readfile/encode.go (93%) rename {filebeat => libbeat}/reader/readfile/encoding/encoding.go (100%) rename {filebeat => libbeat}/reader/readfile/encoding/mixed.go (100%) rename {filebeat => libbeat}/reader/readfile/encoding/utf16.go (100%) rename {filebeat => libbeat}/reader/readfile/encoding/utf16_test.go (100%) rename {filebeat => libbeat}/reader/readfile/limit.go (97%) rename {filebeat => libbeat}/reader/readfile/limit_test.go (100%) rename {filebeat => libbeat}/reader/readfile/line.go (100%) rename {filebeat => libbeat}/reader/readfile/line_test.go (100%) rename {filebeat => libbeat}/reader/readfile/strip_newline.go (97%) rename {filebeat => libbeat}/reader/readfile/strip_newline_test.go (100%) rename {filebeat => libbeat}/reader/readfile/timeout.go (98%) rename {filebeat => libbeat}/reader/readjson/docker_json.go (98%) rename {filebeat => libbeat}/reader/readjson/docker_json_test.go (100%) rename {filebeat => libbeat}/reader/readjson/json.go (99%) rename {filebeat => libbeat}/reader/readjson/json_config.go (100%) rename {filebeat => libbeat}/reader/readjson/json_test.go (100%) diff --git a/filebeat/input/log/config.go b/filebeat/input/log/config.go index b88c11d932b1..fe1f81a6e6b8 100644 --- a/filebeat/input/log/config.go +++ b/filebeat/input/log/config.go @@ -27,11 +27,11 @@ import ( cfg "github.com/elastic/beats/filebeat/config" "github.com/elastic/beats/filebeat/harvester" "github.com/elastic/beats/filebeat/input/file" - "github.com/elastic/beats/filebeat/reader/multiline" - "github.com/elastic/beats/filebeat/reader/readjson" "github.com/elastic/beats/libbeat/common/cfgwarn" "github.com/elastic/beats/libbeat/common/match" "github.com/elastic/beats/libbeat/logp" + "github.com/elastic/beats/libbeat/reader/multiline" + "github.com/elastic/beats/libbeat/reader/readjson" ) var ( diff --git a/filebeat/input/log/harvester.go b/filebeat/input/log/harvester.go index d5ffb3a38285..2290630f9084 100644 --- a/filebeat/input/log/harvester.go +++ b/filebeat/input/log/harvester.go @@ -49,12 +49,12 @@ import ( "github.com/elastic/beats/filebeat/channel" "github.com/elastic/beats/filebeat/harvester" "github.com/elastic/beats/filebeat/input/file" - "github.com/elastic/beats/filebeat/reader" - "github.com/elastic/beats/filebeat/reader/multiline" - "github.com/elastic/beats/filebeat/reader/readfile" - "github.com/elastic/beats/filebeat/reader/readfile/encoding" - "github.com/elastic/beats/filebeat/reader/readjson" "github.com/elastic/beats/filebeat/util" + "github.com/elastic/beats/libbeat/reader" + "github.com/elastic/beats/libbeat/reader/multiline" + "github.com/elastic/beats/libbeat/reader/readfile" + "github.com/elastic/beats/libbeat/reader/readfile/encoding" + "github.com/elastic/beats/libbeat/reader/readjson" ) var ( diff --git a/filebeat/input/log/harvester_test.go b/filebeat/input/log/harvester_test.go index f3f6697a8de3..fe3d7c4d1fca 100644 --- a/filebeat/input/log/harvester_test.go +++ b/filebeat/input/log/harvester_test.go @@ -30,9 +30,9 @@ import ( "github.com/stretchr/testify/assert" - "github.com/elastic/beats/filebeat/reader" - "github.com/elastic/beats/filebeat/reader/readfile/encoding" "github.com/elastic/beats/libbeat/common" + "github.com/elastic/beats/libbeat/reader" + "github.com/elastic/beats/libbeat/reader/readfile/encoding" ) func TestReadLine(t *testing.T) { diff --git a/filebeat/scripts/tester/main.go b/filebeat/scripts/tester/main.go index 3300b8ef623a..5a3d277b6e86 100644 --- a/filebeat/scripts/tester/main.go +++ b/filebeat/scripts/tester/main.go @@ -29,12 +29,12 @@ import ( "strings" "time" - "github.com/elastic/beats/filebeat/reader" - "github.com/elastic/beats/filebeat/reader/multiline" - "github.com/elastic/beats/filebeat/reader/readfile" - "github.com/elastic/beats/filebeat/reader/readfile/encoding" "github.com/elastic/beats/libbeat/common" "github.com/elastic/beats/libbeat/common/match" + "github.com/elastic/beats/libbeat/reader" + "github.com/elastic/beats/libbeat/reader/multiline" + "github.com/elastic/beats/libbeat/reader/readfile" + "github.com/elastic/beats/libbeat/reader/readfile/encoding" ) type logReaderConfig struct { diff --git a/filebeat/reader/doc.go b/libbeat/reader/doc.go similarity index 100% rename from filebeat/reader/doc.go rename to libbeat/reader/doc.go diff --git a/filebeat/reader/message.go b/libbeat/reader/message.go similarity index 100% rename from filebeat/reader/message.go rename to libbeat/reader/message.go diff --git a/filebeat/reader/multiline/multiline.go b/libbeat/reader/multiline/multiline.go similarity index 98% rename from filebeat/reader/multiline/multiline.go rename to libbeat/reader/multiline/multiline.go index ae31c399ecb9..cf3b586d1caa 100644 --- a/filebeat/reader/multiline/multiline.go +++ b/libbeat/reader/multiline/multiline.go @@ -22,10 +22,10 @@ import ( "fmt" "time" - "github.com/elastic/beats/filebeat/reader" - "github.com/elastic/beats/filebeat/reader/readfile" "github.com/elastic/beats/libbeat/common/match" "github.com/elastic/beats/libbeat/logp" + "github.com/elastic/beats/libbeat/reader" + "github.com/elastic/beats/libbeat/reader/readfile" ) // MultiLine reader combining multiple line events into one multi-line event. diff --git a/filebeat/reader/multiline/multiline_config.go b/libbeat/reader/multiline/multiline_config.go similarity index 100% rename from filebeat/reader/multiline/multiline_config.go rename to libbeat/reader/multiline/multiline_config.go diff --git a/filebeat/reader/multiline/multiline_test.go b/libbeat/reader/multiline/multiline_test.go similarity index 100% rename from filebeat/reader/multiline/multiline_test.go rename to libbeat/reader/multiline/multiline_test.go diff --git a/filebeat/reader/reader.go b/libbeat/reader/reader.go similarity index 100% rename from filebeat/reader/reader.go rename to libbeat/reader/reader.go diff --git a/filebeat/reader/readfile/encode.go b/libbeat/reader/readfile/encode.go similarity index 93% rename from filebeat/reader/readfile/encode.go rename to libbeat/reader/readfile/encode.go index a86e6541bec6..419a5de2c1e0 100644 --- a/filebeat/reader/readfile/encode.go +++ b/libbeat/reader/readfile/encode.go @@ -21,8 +21,8 @@ import ( "io" "time" - "github.com/elastic/beats/filebeat/reader" - "github.com/elastic/beats/filebeat/reader/readfile/encoding" + "github.com/elastic/beats/libbeat/reader" + "github.com/elastic/beats/libbeat/reader/readfile/encoding" ) // Reader produces lines by reading lines from an io.Reader diff --git a/filebeat/reader/readfile/encoding/encoding.go b/libbeat/reader/readfile/encoding/encoding.go similarity index 100% rename from filebeat/reader/readfile/encoding/encoding.go rename to libbeat/reader/readfile/encoding/encoding.go diff --git a/filebeat/reader/readfile/encoding/mixed.go b/libbeat/reader/readfile/encoding/mixed.go similarity index 100% rename from filebeat/reader/readfile/encoding/mixed.go rename to libbeat/reader/readfile/encoding/mixed.go diff --git a/filebeat/reader/readfile/encoding/utf16.go b/libbeat/reader/readfile/encoding/utf16.go similarity index 100% rename from filebeat/reader/readfile/encoding/utf16.go rename to libbeat/reader/readfile/encoding/utf16.go diff --git a/filebeat/reader/readfile/encoding/utf16_test.go b/libbeat/reader/readfile/encoding/utf16_test.go similarity index 100% rename from filebeat/reader/readfile/encoding/utf16_test.go rename to libbeat/reader/readfile/encoding/utf16_test.go diff --git a/filebeat/reader/readfile/limit.go b/libbeat/reader/readfile/limit.go similarity index 97% rename from filebeat/reader/readfile/limit.go rename to libbeat/reader/readfile/limit.go index 42f9635ba124..aff5fac67345 100644 --- a/filebeat/reader/readfile/limit.go +++ b/libbeat/reader/readfile/limit.go @@ -18,7 +18,7 @@ package readfile import ( - "github.com/elastic/beats/filebeat/reader" + "github.com/elastic/beats/libbeat/reader" ) // Reader sets an upper limited on line length. Lines longer diff --git a/filebeat/reader/readfile/limit_test.go b/libbeat/reader/readfile/limit_test.go similarity index 100% rename from filebeat/reader/readfile/limit_test.go rename to libbeat/reader/readfile/limit_test.go diff --git a/filebeat/reader/readfile/line.go b/libbeat/reader/readfile/line.go similarity index 100% rename from filebeat/reader/readfile/line.go rename to libbeat/reader/readfile/line.go diff --git a/filebeat/reader/readfile/line_test.go b/libbeat/reader/readfile/line_test.go similarity index 100% rename from filebeat/reader/readfile/line_test.go rename to libbeat/reader/readfile/line_test.go diff --git a/filebeat/reader/readfile/strip_newline.go b/libbeat/reader/readfile/strip_newline.go similarity index 97% rename from filebeat/reader/readfile/strip_newline.go rename to libbeat/reader/readfile/strip_newline.go index 3394cb9289e4..8f0b0bc21e7e 100644 --- a/filebeat/reader/readfile/strip_newline.go +++ b/libbeat/reader/readfile/strip_newline.go @@ -18,7 +18,7 @@ package readfile import ( - "github.com/elastic/beats/filebeat/reader" + "github.com/elastic/beats/libbeat/reader" ) // StripNewline reader removes the last trailing newline characters from diff --git a/filebeat/reader/readfile/strip_newline_test.go b/libbeat/reader/readfile/strip_newline_test.go similarity index 100% rename from filebeat/reader/readfile/strip_newline_test.go rename to libbeat/reader/readfile/strip_newline_test.go diff --git a/filebeat/reader/readfile/timeout.go b/libbeat/reader/readfile/timeout.go similarity index 98% rename from filebeat/reader/readfile/timeout.go rename to libbeat/reader/readfile/timeout.go index ea73bd607375..b89a7fc2d8e0 100644 --- a/filebeat/reader/readfile/timeout.go +++ b/libbeat/reader/readfile/timeout.go @@ -21,7 +21,7 @@ import ( "errors" "time" - "github.com/elastic/beats/filebeat/reader" + "github.com/elastic/beats/libbeat/reader" ) var ( diff --git a/filebeat/reader/readjson/docker_json.go b/libbeat/reader/readjson/docker_json.go similarity index 98% rename from filebeat/reader/readjson/docker_json.go rename to libbeat/reader/readjson/docker_json.go index f9d4e80626dd..b7d94c39d842 100644 --- a/filebeat/reader/readjson/docker_json.go +++ b/libbeat/reader/readjson/docker_json.go @@ -23,8 +23,8 @@ import ( "strings" "time" - "github.com/elastic/beats/filebeat/reader" "github.com/elastic/beats/libbeat/common" + "github.com/elastic/beats/libbeat/reader" "github.com/pkg/errors" ) diff --git a/filebeat/reader/readjson/docker_json_test.go b/libbeat/reader/readjson/docker_json_test.go similarity index 100% rename from filebeat/reader/readjson/docker_json_test.go rename to libbeat/reader/readjson/docker_json_test.go diff --git a/filebeat/reader/readjson/json.go b/libbeat/reader/readjson/json.go similarity index 99% rename from filebeat/reader/readjson/json.go rename to libbeat/reader/readjson/json.go index 2b6207a74dc2..f306ac4622bb 100644 --- a/filebeat/reader/readjson/json.go +++ b/libbeat/reader/readjson/json.go @@ -23,11 +23,11 @@ import ( "fmt" "time" - "github.com/elastic/beats/filebeat/reader" "github.com/elastic/beats/libbeat/beat" "github.com/elastic/beats/libbeat/common" "github.com/elastic/beats/libbeat/common/jsontransform" "github.com/elastic/beats/libbeat/logp" + "github.com/elastic/beats/libbeat/reader" ) // JSONReader parses JSON inputs diff --git a/filebeat/reader/readjson/json_config.go b/libbeat/reader/readjson/json_config.go similarity index 100% rename from filebeat/reader/readjson/json_config.go rename to libbeat/reader/readjson/json_config.go diff --git a/filebeat/reader/readjson/json_test.go b/libbeat/reader/readjson/json_test.go similarity index 100% rename from filebeat/reader/readjson/json_test.go rename to libbeat/reader/readjson/json_test.go From 08cb259ed783b1d7ac3a814fa9619b58c075afb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mi=20V=C3=A1nyi?= Date: Mon, 3 Sep 2018 20:59:45 +0200 Subject: [PATCH 2/3] more imports --- libbeat/reader/multiline/multiline_test.go | 6 +++--- libbeat/reader/readfile/limit_test.go | 2 +- libbeat/reader/readfile/line_test.go | 2 +- libbeat/reader/readjson/docker_json_test.go | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libbeat/reader/multiline/multiline_test.go b/libbeat/reader/multiline/multiline_test.go index 96dfd6922ccc..95aba3c25565 100644 --- a/libbeat/reader/multiline/multiline_test.go +++ b/libbeat/reader/multiline/multiline_test.go @@ -29,10 +29,10 @@ import ( "github.com/stretchr/testify/assert" - "github.com/elastic/beats/filebeat/reader" - "github.com/elastic/beats/filebeat/reader/readfile" - "github.com/elastic/beats/filebeat/reader/readfile/encoding" "github.com/elastic/beats/libbeat/common/match" + "github.com/elastic/beats/libbeat/reader" + "github.com/elastic/beats/libbeat/reader/readfile" + "github.com/elastic/beats/libbeat/reader/readfile/encoding" ) type bufferSource struct{ buf *bytes.Buffer } diff --git a/libbeat/reader/readfile/limit_test.go b/libbeat/reader/readfile/limit_test.go index c7096cb938f3..9f72d297475b 100644 --- a/libbeat/reader/readfile/limit_test.go +++ b/libbeat/reader/readfile/limit_test.go @@ -24,7 +24,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/elastic/beats/filebeat/reader" + "github.com/elastic/beats/libbeat/reader" ) type mockReader struct { diff --git a/libbeat/reader/readfile/line_test.go b/libbeat/reader/readfile/line_test.go index 9d244f0decfa..11e7fc5ac363 100644 --- a/libbeat/reader/readfile/line_test.go +++ b/libbeat/reader/readfile/line_test.go @@ -27,7 +27,7 @@ import ( "github.com/stretchr/testify/assert" "golang.org/x/text/transform" - "github.com/elastic/beats/filebeat/reader/readfile/encoding" + "github.com/elastic/beats/libbeat/reader/readfile/encoding" ) // Sample texts are from http://www.columbia.edu/~kermit/utf8.html diff --git a/libbeat/reader/readjson/docker_json_test.go b/libbeat/reader/readjson/docker_json_test.go index 642113a1e903..281ed7d6394f 100644 --- a/libbeat/reader/readjson/docker_json_test.go +++ b/libbeat/reader/readjson/docker_json_test.go @@ -21,8 +21,8 @@ import ( "testing" "time" - "github.com/elastic/beats/filebeat/reader" "github.com/elastic/beats/libbeat/common" + "github.com/elastic/beats/libbeat/reader" "github.com/stretchr/testify/assert" ) From 6cdbfd892650c106611c0533864f6c8c9cba6f4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mi=20V=C3=A1nyi?= Date: Tue, 4 Sep 2018 19:35:47 +0200 Subject: [PATCH 3/3] add entry to dev changelog --- CHANGELOG-developer.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG-developer.asciidoc b/CHANGELOG-developer.asciidoc index e575d97110f6..960c800053b9 100644 --- a/CHANGELOG-developer.asciidoc +++ b/CHANGELOG-developer.asciidoc @@ -46,3 +46,4 @@ The list below covers the major changes between 6.3.0 and master only. `mage -h goTestUnit`. {pull}7766[7766] - Beats packaging now build non-oss binaries from code located in the x-pack folder. {issue}7783[7783] - New function `AddTagsWithKey` is added, so `common.MapStr` can be enriched with tags with an arbitrary key. {pull}7991[7991] +- Move filebeat/reader to libbeat/reader {pull}8206[8206]