Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Filebeat] Enable journald input in releases #27351

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Apache: convert status.total_kbytes to status.total_bytes in fleet mode. {pull}23022[23022]
- Release MSSQL as GA {pull}23146[23146]
- Add AWS Kinesis metricset. {pull}25989[25989]
- Enable `journald` input type in Filebeat. {issue}7955[7955] {pull}27351[27351]
- Move openmetrics module to oss. {pull}26561[26561]
- Add `gke` metricset collection to `gcp` module {pull}26824[26824]

Expand Down
75 changes: 19 additions & 56 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4503,12 +4503,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


--------------------------------------------------------------------------------
Dependency : github.com/dgraph-io/badger/v2
Version: v2.2007.3-0.20201012072640-f5a7e0a1c83b
Dependency : github.com/dgraph-io/badger/v3
Version: v3.2103.1
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/dgraph-io/badger/v2@v2.2007.3-0.20201012072640-f5a7e0a1c83b/LICENSE:
Contents of probable licence file $GOMODCACHE/github.com/dgraph-io/badger/v3@v3.2103.1/LICENSE:

Apache License
Version 2.0, January 2004
Expand Down Expand Up @@ -9785,11 +9785,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

--------------------------------------------------------------------------------
Dependency : github.com/gogo/protobuf
Version: v1.3.1
Version: v1.3.2
Licence type (autodetected): BSD-3-Clause
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/gogo/protobuf@v1.3.1/LICENSE:
Contents of probable licence file $GOMODCACHE/github.com/gogo/protobuf@v1.3.2/LICENSE:

Copyright (c) 2013, The GoGo Authors. All rights reserved.

Expand Down Expand Up @@ -10304,11 +10304,11 @@ Contents of probable licence file $GOMODCACHE/github.com/gomodule/redigo@v1.8.3/

--------------------------------------------------------------------------------
Dependency : github.com/google/flatbuffers
Version: v1.7.2-0.20170925184458-7a6b2bf521e9
Version: v1.12.0
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/google/flatbuffers@v1.7.2-0.20170925184458-7a6b2bf521e9/LICENSE.txt:
Contents of probable licence file $GOMODCACHE/github.com/google/flatbuffers@v1.12.0/LICENSE.txt:


Apache License
Expand Down Expand Up @@ -10499,7 +10499,7 @@ Contents of probable licence file $GOMODCACHE/github.com/google/flatbuffers@v1.7
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2014 Google Inc.
Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -21820,43 +21820,6 @@ Contents of probable licence file $GOMODCACHE/github.com/!burnt!sushi/xgb@v0.0.0
// such litigation is filed.


--------------------------------------------------------------------------------
Dependency : github.com/DataDog/zstd
Version: v1.4.1
Licence type (autodetected): BSD-3-Clause
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/!data!dog/zstd@v1.4.1/LICENSE:

Simplified BSD License

Copyright (c) 2016, Datadog <info@datadoghq.com>
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


--------------------------------------------------------------------------------
Dependency : github.com/Microsoft/hcsshim
Version: v0.8.7
Expand Down Expand Up @@ -26457,11 +26420,11 @@ SOFTWARE.

--------------------------------------------------------------------------------
Dependency : github.com/dgraph-io/ristretto
Version: v0.0.3-0.20200630154024-f66de99634de
Version: v0.1.0
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/dgraph-io/ristretto@v0.0.3-0.20200630154024-f66de99634de/LICENSE:
Contents of probable licence file $GOMODCACHE/github.com/dgraph-io/ristretto@v0.1.0/LICENSE:

Apache License
Version 2.0, January 2004
Expand Down Expand Up @@ -29878,12 +29841,12 @@ Contents of probable licence file $GOMODCACHE/github.com/golang-sql/civil@v0.0.0
limitations under the License.

--------------------------------------------------------------------------------
Dependency : github.com/golang/glog
Version: v0.0.0-20160126235308-23def4e6c14b
Dependency : github.com/elastic/glog
Version: v1.0.1-0.20210831205241-7d8b5c89dfc4
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/golang/glog@v0.0.0-20160126235308-23def4e6c14b/LICENSE:
Contents of probable licence file $GOMODCACHE/github.com/elastic/glog@v1.0.1-0.20210831205241-7d8b5c89dfc4/LICENSE:

Apache License
Version 2.0, January 2004
Expand Down Expand Up @@ -36163,11 +36126,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

--------------------------------------------------------------------------------
Dependency : github.com/kisielk/errcheck
Version: v1.2.0
Version: v1.5.0
Licence type (autodetected): MIT
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/kisielk/errcheck@v1.2.0/LICENSE:
Contents of probable licence file $GOMODCACHE/github.com/kisielk/errcheck@v1.5.0/LICENSE:

Copyright (c) 2013 Kamil Kisiel

Expand Down Expand Up @@ -36237,11 +36200,11 @@ match.go, match_test.go:

--------------------------------------------------------------------------------
Dependency : github.com/klauspost/compress
Version: v1.12.2
Version: v1.12.3
Licence type (autodetected): BSD-3-Clause
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/klauspost/compress@v1.12.2/LICENSE:
Contents of probable licence file $GOMODCACHE/github.com/klauspost/compress@v1.12.3/LICENSE:

Copyright (c) 2012 The Go Authors. All rights reserved.
Copyright (c) 2019 Klaus Post. All rights reserved.
Expand Down Expand Up @@ -41887,11 +41850,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI

--------------------------------------------------------------------------------
Dependency : go.opencensus.io
Version: v0.22.2
Version: v0.22.5
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/go.opencensus.io@v0.22.2/LICENSE:
Contents of probable licence file $GOMODCACHE/go.opencensus.io@v0.22.5/LICENSE:


Apache License
Expand Down
47 changes: 47 additions & 0 deletions dev-tools/mage/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"context"
"crypto/sha256"
"crypto/sha512"
"debug/elf"
"encoding/hex"
"encoding/json"
"fmt"
Expand All @@ -38,6 +39,7 @@ import (
"path/filepath"
"regexp"
"runtime"
"sort"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -913,3 +915,48 @@ func IntegrationTestEnvVars() []string {
}
return vars
}

// ReadGLIBCRequirement returns the required glibc version for a dynamically
// linked ELF binary. The target machine must have a version equal to or
// greater than (newer) the returned value.
func ReadGLIBCRequirement(elfFile string) (*SemanticVersion, error) {
e, err := elf.Open(elfFile)
if err != nil {
return nil, err
}

symbols, err := e.DynamicSymbols()
if err != nil {
return nil, err
}

versionSet := map[SemanticVersion]struct{}{}
for _, sym := range symbols {
if strings.HasPrefix(sym.Version, "GLIBC_") {
semver, err := NewSemanticVersion(strings.TrimPrefix(sym.Version, "GLIBC_"))
if err != nil {
continue
}

versionSet[*semver] = struct{}{}
}
}

if len(versionSet) == 0 {
return nil, errors.New("no GLIBC symbols found in binary (is this a static binary?)")
}

var versions []SemanticVersion
for ver := range versionSet {
versions = append(versions, ver)
}

sort.Slice(versions, func(i, j int) bool {
a := versions[i]
b := versions[j]
return a.LessThan(&b)
})

max := versions[len(versions)-1]
andrewkroh marked this conversation as resolved.
Show resolved Hide resolved
return &max, nil
}
4 changes: 2 additions & 2 deletions dev-tools/mage/crossbuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ type crossBuildParams struct {

// CrossBuild executes a given build target once for each target platform.
func CrossBuild(options ...CrossBuildOption) error {
params := crossBuildParams{Platforms: Platforms, Target: defaultCrossBuildTarget, ImageSelector: crossBuildImage}
params := crossBuildParams{Platforms: Platforms, Target: defaultCrossBuildTarget, ImageSelector: CrossBuildImage}
for _, opt := range options {
opt(&params)
}
Expand Down Expand Up @@ -193,7 +193,7 @@ func buildMage() error {
"-compile", CreateDir(filepath.Join("build", "mage-linux-"+arch)))
}

func crossBuildImage(platform string) (string, error) {
func CrossBuildImage(platform string) (string, error) {
tagSuffix := "main"

switch {
Expand Down
36 changes: 36 additions & 0 deletions dev-tools/mage/pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"fmt"
"log"
"os"
"path/filepath"
"runtime"
"strconv"

Expand Down Expand Up @@ -242,3 +243,38 @@ func TestPackages(options ...TestPackagesOption) error {

return nil
}

// TestLinuxForCentosGLIBC checks the GLIBC requirements of linux/amd64 and
// linux/386 binaries to ensure they meet the requirements for RHEL 6 which has
// glibc 2.12.
func TestLinuxForCentosGLIBC() error {
switch Platform.Name {
case "linux/amd64", "linux/386":
return TestBinaryGLIBCVersion(filepath.Join("build/golang-crossbuild", BeatName+"-linux-"+Platform.GOARCH), "2.12")
default:
return nil
}
}

func TestBinaryGLIBCVersion(elfPath, maxGlibcVersion string) error {
requiredGlibc, err := ReadGLIBCRequirement(elfPath)
if err != nil {
if errors.Is(err, os.ErrNotExist) {
return nil
}
return err
}

upperBound, err := NewSemanticVersion(maxGlibcVersion)
if err != nil {
return err
}

if !requiredGlibc.LessThanOrEqual(upperBound) {
return fmt.Errorf("dynamically linked binary %q requires glibc "+
"%v, but maximum allowed glibc is %v",
elfPath, requiredGlibc, upperBound)
}
fmt.Printf(">> testBinaryGLIBCVersion: %q requires glibc %v or greater\n", elfPath, requiredGlibc)
return nil
}
67 changes: 67 additions & 0 deletions dev-tools/mage/semver.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

package mage

import (
"fmt"
"regexp"
"strconv"
)

var SemanticVersionRegex = regexp.MustCompile(`(?m)^(\d+)\.(\d+)(?:\.(\d+))?`)

type SemanticVersion struct {
Major, Minor, Patch int
}

// NewSemanticVersion return a new SemanticVersion parsed from string in the
// format of 'x.y' or 'x.y.z'.
func NewSemanticVersion(s string) (*SemanticVersion, error) {
matches := SemanticVersionRegex.FindStringSubmatch(s)
if len(matches) < 4 {
return nil, fmt.Errorf("invalid version format %q", s)
}

major, _ := strconv.Atoi(matches[1])
Minor, _ := strconv.Atoi(matches[2])
Patch, _ := strconv.Atoi(matches[3])
return &SemanticVersion{major, Minor, Patch}, nil
}

// LessThan return true iff s is less than x.
func (s *SemanticVersion) LessThan(x *SemanticVersion) bool {
if s.Major != x.Major {
return s.Major < x.Major
}
if s.Minor != x.Minor {
return s.Minor < x.Minor
}
return s.Patch < x.Patch
}

// LessThanOrEqual return true iff s is less than or equal to x.
func (s *SemanticVersion) LessThanOrEqual(x *SemanticVersion) bool {
if s.LessThan(x) {
return true
}
return !x.LessThan(s)
}

func (s SemanticVersion) String() string {
return fmt.Sprintf("%d.%d.%d", s.Major, s.Minor, s.Patch)
}
3 changes: 3 additions & 0 deletions filebeat/docs/filebeat-options.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ You can configure {beatname_uc} to use the following inputs:
* <<{beatname_lc}-input-gcp-pubsub>>
* <<{beatname_lc}-input-http_endpoint>>
* <<{beatname_lc}-input-httpjson>>
* <<{beatname_lc}-input-journald>>
* <<{beatname_lc}-input-kafka>>
* <<{beatname_lc}-input-log>>
* <<{beatname_lc}-input-mqtt>>
Expand Down Expand Up @@ -106,6 +107,8 @@ include::../../x-pack/filebeat/docs/inputs/input-http-endpoint.asciidoc[]

include::../../x-pack/filebeat/docs/inputs/input-httpjson.asciidoc[]

include::inputs/input-journald.asciidoc[]

include::inputs/input-kafka.asciidoc[]

include::inputs/input-log.asciidoc[]
Expand Down
Loading