diff --git a/CHANGELOG-developer.asciidoc b/CHANGELOG-developer.asciidoc index e575d97110f..960c800053b 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] diff --git a/filebeat/input/log/config.go b/filebeat/input/log/config.go index b88c11d932b..fe1f81a6e6b 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 d5ffb3a3828..2290630f908 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 f3f6697a8de..fe3d7c4d1fc 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 3300b8ef623..5a3d277b6e8 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 ae31c399ecb..cf3b586d1ca 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 97% rename from filebeat/reader/multiline/multiline_test.go rename to libbeat/reader/multiline/multiline_test.go index 96dfd6922cc..95aba3c2556 100644 --- a/filebeat/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/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 a86e6541bec..419a5de2c1e 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 42f9635ba12..aff5fac6734 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 97% rename from filebeat/reader/readfile/limit_test.go rename to libbeat/reader/readfile/limit_test.go index c7096cb938f..9f72d297475 100644 --- a/filebeat/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/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 98% rename from filebeat/reader/readfile/line_test.go rename to libbeat/reader/readfile/line_test.go index 9d244f0decf..11e7fc5ac36 100644 --- a/filebeat/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/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 3394cb9289e..8f0b0bc21e7 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 ea73bd60737..b89a7fc2d8e 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 f9d4e80626d..b7d94c39d84 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 99% rename from filebeat/reader/readjson/docker_json_test.go rename to libbeat/reader/readjson/docker_json_test.go index 642113a1e90..281ed7d6394 100644 --- a/filebeat/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" ) 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 2b6207a74dc..f306ac4622b 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