diff --git a/NOTICE.txt b/NOTICE.txt index afbd6a0e21ed..583dbb68e0d4 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -14358,6 +14358,38 @@ See the License for the specific language governing permissions and limitations under the License. +-------------------------------------------------------------------------------- +Dependency : github.com/elastic/lumberjack +Version: v0.0.0-20260715013204-c5b60bbeaaab +Licence type (autodetected): MIT +-------------------------------------------------------------------------------- + +Contents of probable licence file $GOMODCACHE/github.com/elastic/lumberjack@v0.0.0-20260715013204-c5b60bbeaaab/LICENSE: + +The MIT License (MIT) + +Copyright (c) 2014 Nate Finch +Copyright (c) 2026 Elasticsearch B.V. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + -------------------------------------------------------------------------------- Dependency : github.com/elastic/mito Version: v1.23.2 @@ -30666,36 +30698,6 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------- -Dependency : gopkg.in/natefinch/lumberjack.v2 -Version: v2.2.1 -Licence type (autodetected): MIT --------------------------------------------------------------------------------- - -Contents of probable licence file $GOMODCACHE/gopkg.in/natefinch/lumberjack.v2@v2.2.1/LICENSE: - -The MIT License (MIT) - -Copyright (c) 2014 Nate Finch - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -------------------------------------------------------------------------------- Dependency : gopkg.in/yaml.v2 Version: v2.4.0 diff --git a/changelog/fragments/1784080439-49092-lumberjack.yaml b/changelog/fragments/1784080439-49092-lumberjack.yaml new file mode 100644 index 000000000000..9b6a5740d4f5 --- /dev/null +++ b/changelog/fragments/1784080439-49092-lumberjack.yaml @@ -0,0 +1,3 @@ +kind: bug-fix +summary: Fix goroutine leak in request trace logging infrastructure. +component: filebeat diff --git a/go.mod b/go.mod index 90c0c8e12c7d..cb783b300606 100644 --- a/go.mod +++ b/go.mod @@ -227,7 +227,6 @@ require ( go.uber.org/mock v0.5.0 golang.org/x/term v0.43.0 google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa - gopkg.in/natefinch/lumberjack.v2 v2.2.1 gopkg.in/yaml.v3 v3.0.1 ) @@ -236,6 +235,7 @@ require ( github.com/cilium/ebpf v0.21.0 github.com/coder/websocket v1.8.14 github.com/elastic/gokrb5/v8 v8.0.0-20251105095404-23cc45e6a102 + github.com/elastic/lumberjack v0.0.0-20260715013204-c5b60bbeaaab github.com/gorilla/mux v1.8.1 github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 github.com/mitchellh/gox v1.0.1 diff --git a/go.sum b/go.sum index f568f954db20..f0802c9879ca 100644 --- a/go.sum +++ b/go.sum @@ -410,6 +410,8 @@ github.com/elastic/gopacket v1.1.20-0.20241002174017-e8c5fda595e6 h1:VgOx6omXIMK github.com/elastic/gopacket v1.1.20-0.20241002174017-e8c5fda595e6/go.mod h1:riddUzxTSBpJXk3qBHtYr4qOhFhT6k/1c0E3qkQjQpA= github.com/elastic/gosigar v0.14.4 h1:7NRnWJDFjEKpOjnHhtzrPGZWr9EMrYFsLjF4q0Czosk= github.com/elastic/gosigar v0.14.4/go.mod h1:tx91Eb3YgFk6y++h88fRAnxic3Si1ZDHooqnJU/hqo8= +github.com/elastic/lumberjack v0.0.0-20260715013204-c5b60bbeaaab h1:p33sNyLrsWoIoRFL3E6hKajacBbsHuST8xW7y7cxGzY= +github.com/elastic/lumberjack v0.0.0-20260715013204-c5b60bbeaaab/go.mod h1:t8v3y03G3KubyWgYqe+Jcxj/jDddnkp70743iSYrQiU= github.com/elastic/mito v1.23.2 h1:cEtTsCdIoqglm1847b9NKu4HGImRcL4VA0exakfWCMw= github.com/elastic/mito v1.23.2/go.mod h1:nmkKaLmNGWf79vthVZcNBvKZCAFCaxx4I1LcJ1+OAfU= github.com/elastic/mock-es v0.0.0-20250530054253-8c3b6053f9b6 h1:JVNuBrmOoqLJgp9o68YBMnOrXCzQI3mCppW+suwRSlw= @@ -1525,8 +1527,6 @@ gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/mcuadros/go-syslog.v2 v2.3.0 h1:kcsiS+WsTKyIEPABJBJtoG0KkOS6yzvJ+/eZlhD79kk= gopkg.in/mcuadros/go-syslog.v2 v2.3.0/go.mod h1:l5LPIyOOyIdQquNg+oU6Z3524YwrcqEm0aKH+5zpt2U= -gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= -gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0/go.mod h1:WDnlLJ4WF5VGsH/HVa3CI79GS0ol3YnhVnKP89i0kNg= diff --git a/x-pack/filebeat/input/cel/config.go b/x-pack/filebeat/input/cel/config.go index 9ab185c07f88..f53def7f2049 100644 --- a/x-pack/filebeat/input/cel/config.go +++ b/x-pack/filebeat/input/cel/config.go @@ -13,11 +13,11 @@ import ( "regexp" "time" - "gopkg.in/natefinch/lumberjack.v2" "gopkg.in/yaml.v3" "github.com/elastic/elastic-agent-libs/logp" "github.com/elastic/elastic-agent-libs/transport/httpcommon" + "github.com/elastic/lumberjack" "github.com/elastic/mito/lib" ) diff --git a/x-pack/filebeat/input/entityanalytics/provider/azuread/fetcher/graph/graph.go b/x-pack/filebeat/input/entityanalytics/provider/azuread/fetcher/graph/graph.go index ef1fc37c2c96..cefea15a2a11 100644 --- a/x-pack/filebeat/input/entityanalytics/provider/azuread/fetcher/graph/graph.go +++ b/x-pack/filebeat/input/entityanalytics/provider/azuread/fetcher/graph/graph.go @@ -22,7 +22,6 @@ import ( "go.elastic.co/ecszap" "go.uber.org/zap" "go.uber.org/zap/zapcore" - "gopkg.in/natefinch/lumberjack.v2" "github.com/elastic/beats/v7/x-pack/filebeat/input/entityanalytics/internal/collections" "github.com/elastic/beats/v7/x-pack/filebeat/input/entityanalytics/provider/azuread/authenticator" @@ -33,6 +32,7 @@ import ( "github.com/elastic/elastic-agent-libs/mapstr" "github.com/elastic/elastic-agent-libs/paths" "github.com/elastic/elastic-agent-libs/transport/httpcommon" + "github.com/elastic/lumberjack" ) const ( diff --git a/x-pack/filebeat/input/entityanalytics/provider/azuread/fetcher/graph/graph_test.go b/x-pack/filebeat/input/entityanalytics/provider/azuread/fetcher/graph/graph_test.go index c2c889937b7c..54b3b1d5a850 100644 --- a/x-pack/filebeat/input/entityanalytics/provider/azuread/fetcher/graph/graph_test.go +++ b/x-pack/filebeat/input/entityanalytics/provider/azuread/fetcher/graph/graph_test.go @@ -20,7 +20,6 @@ import ( "github.com/gofrs/uuid/v5" "github.com/google/go-cmp/cmp" "github.com/stretchr/testify/require" - "gopkg.in/natefinch/lumberjack.v2" "github.com/elastic/beats/v7/x-pack/filebeat/input/entityanalytics/internal/collections" "github.com/elastic/beats/v7/x-pack/filebeat/input/entityanalytics/provider/azuread/authenticator/mock" @@ -28,6 +27,7 @@ import ( "github.com/elastic/elastic-agent-libs/config" "github.com/elastic/elastic-agent-libs/logp" "github.com/elastic/elastic-agent-libs/paths" + "github.com/elastic/lumberjack" ) var trace = flag.Bool("request_trace", false, "enable request tracing during tests") diff --git a/x-pack/filebeat/input/entityanalytics/provider/jamf/conf.go b/x-pack/filebeat/input/entityanalytics/provider/jamf/conf.go index 0383c462e0fe..3b860eeb9bb5 100644 --- a/x-pack/filebeat/input/entityanalytics/provider/jamf/conf.go +++ b/x-pack/filebeat/input/entityanalytics/provider/jamf/conf.go @@ -8,9 +8,8 @@ import ( "errors" "time" - "gopkg.in/natefinch/lumberjack.v2" - "github.com/elastic/elastic-agent-libs/transport/httpcommon" + "github.com/elastic/lumberjack" ) // defaultConfig returns a default configuration. diff --git a/x-pack/filebeat/input/entityanalytics/provider/jamf/conf_test.go b/x-pack/filebeat/input/entityanalytics/provider/jamf/conf_test.go index ccf345445cff..7aa87ee3fd09 100644 --- a/x-pack/filebeat/input/entityanalytics/provider/jamf/conf_test.go +++ b/x-pack/filebeat/input/entityanalytics/provider/jamf/conf_test.go @@ -10,10 +10,9 @@ import ( "testing" "time" - "gopkg.in/natefinch/lumberjack.v2" - "github.com/elastic/elastic-agent-libs/config" "github.com/elastic/elastic-agent-libs/transport/httpcommon" + "github.com/elastic/lumberjack" ) var validateTests = []struct { diff --git a/x-pack/filebeat/input/entityanalytics/provider/jamf/jamf_test.go b/x-pack/filebeat/input/entityanalytics/provider/jamf/jamf_test.go index 9ca7128d11c3..825e34b67845 100644 --- a/x-pack/filebeat/input/entityanalytics/provider/jamf/jamf_test.go +++ b/x-pack/filebeat/input/entityanalytics/provider/jamf/jamf_test.go @@ -19,10 +19,10 @@ import ( "github.com/gofrs/uuid/v5" "github.com/google/go-cmp/cmp" - "gopkg.in/natefinch/lumberjack.v2" "github.com/elastic/beats/v7/x-pack/filebeat/input/entityanalytics/provider/jamf/internal/jamf" "github.com/elastic/elastic-agent-libs/logp" + "github.com/elastic/lumberjack" ) var trace = flag.Bool("request_trace", false, "enable request tracing during tests") diff --git a/x-pack/filebeat/input/entityanalytics/provider/okta/conf.go b/x-pack/filebeat/input/entityanalytics/provider/okta/conf.go index 02797963d0fe..921cc06a367b 100644 --- a/x-pack/filebeat/input/entityanalytics/provider/okta/conf.go +++ b/x-pack/filebeat/input/entityanalytics/provider/okta/conf.go @@ -9,9 +9,8 @@ import ( "strings" "time" - "gopkg.in/natefinch/lumberjack.v2" - "github.com/elastic/elastic-agent-libs/transport/httpcommon" + "github.com/elastic/lumberjack" ) // defaultConfig returns a default configuration. diff --git a/x-pack/filebeat/input/entityanalytics/provider/okta/conf_test.go b/x-pack/filebeat/input/entityanalytics/provider/okta/conf_test.go index c44c251c673e..9b304593f919 100644 --- a/x-pack/filebeat/input/entityanalytics/provider/okta/conf_test.go +++ b/x-pack/filebeat/input/entityanalytics/provider/okta/conf_test.go @@ -10,10 +10,9 @@ import ( "testing" "time" - "gopkg.in/natefinch/lumberjack.v2" - "github.com/elastic/elastic-agent-libs/config" "github.com/elastic/elastic-agent-libs/transport/httpcommon" + "github.com/elastic/lumberjack" ) var validateTests = []struct { diff --git a/x-pack/filebeat/input/entityanalytics/provider/okta/okta_test.go b/x-pack/filebeat/input/entityanalytics/provider/okta/okta_test.go index 5e9974ee6b8a..adc8ebc53ad8 100644 --- a/x-pack/filebeat/input/entityanalytics/provider/okta/okta_test.go +++ b/x-pack/filebeat/input/entityanalytics/provider/okta/okta_test.go @@ -18,10 +18,9 @@ import ( "testing" "time" - "gopkg.in/natefinch/lumberjack.v2" - "github.com/elastic/beats/v7/x-pack/filebeat/input/entityanalytics/provider/okta/internal/okta" "github.com/elastic/elastic-agent-libs/logp" + "github.com/elastic/lumberjack" ) var trace = flag.Bool("request_trace", false, "enable request tracing during tests") diff --git a/x-pack/filebeat/input/http_endpoint/config.go b/x-pack/filebeat/input/http_endpoint/config.go index 5889824c9cb6..4ee9de08b183 100644 --- a/x-pack/filebeat/input/http_endpoint/config.go +++ b/x-pack/filebeat/input/http_endpoint/config.go @@ -12,9 +12,8 @@ import ( "net/textproto" "strings" - "gopkg.in/natefinch/lumberjack.v2" - "github.com/elastic/elastic-agent-libs/transport/tlscommon" + "github.com/elastic/lumberjack" ) // Available providers for CRC validation (use lowercase) diff --git a/x-pack/filebeat/input/http_endpoint/config_test.go b/x-pack/filebeat/input/http_endpoint/config_test.go index 2e10686f33cb..0fc34ee12ecd 100644 --- a/x-pack/filebeat/input/http_endpoint/config_test.go +++ b/x-pack/filebeat/input/http_endpoint/config_test.go @@ -11,9 +11,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/natefinch/lumberjack.v2" confpkg "github.com/elastic/elastic-agent-libs/config" + "github.com/elastic/lumberjack" ) func Test_validateConfig(t *testing.T) { diff --git a/x-pack/filebeat/input/http_endpoint/handler_test.go b/x-pack/filebeat/input/http_endpoint/handler_test.go index e1045bb932af..8cf0bed3a1fa 100644 --- a/x-pack/filebeat/input/http_endpoint/handler_test.go +++ b/x-pack/filebeat/input/http_endpoint/handler_test.go @@ -23,13 +23,13 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/natefinch/lumberjack.v2" "github.com/elastic/beats/v7/libbeat/beat" "github.com/elastic/beats/v7/testing/testutils" "github.com/elastic/elastic-agent-libs/logp" "github.com/elastic/elastic-agent-libs/mapstr" "github.com/elastic/elastic-agent-libs/monitoring" + "github.com/elastic/lumberjack" ) var withTraces = flag.Bool("log-traces", false, "specify logging request traces during tests") diff --git a/x-pack/filebeat/input/httpjson/config_request.go b/x-pack/filebeat/input/httpjson/config_request.go index 755ef1ae4d84..db034b04377d 100644 --- a/x-pack/filebeat/input/httpjson/config_request.go +++ b/x-pack/filebeat/input/httpjson/config_request.go @@ -12,10 +12,9 @@ import ( "strings" "time" - "gopkg.in/natefinch/lumberjack.v2" - "github.com/elastic/elastic-agent-libs/mapstr" "github.com/elastic/elastic-agent-libs/transport/httpcommon" + "github.com/elastic/lumberjack" ) type retryConfig struct {