Skip to content
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
25 changes: 13 additions & 12 deletions libbeat/beat/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,19 @@ import (

// Info stores a beats instance meta data.
type Info struct {
Beat string // The actual beat's name
IndexPrefix string // The beat's index prefix in Elasticsearch.
Version string // The beat version. Defaults to the libbeat version when an implementation does not set a version
ElasticLicensed bool // Whether the beat is licensed under and Elastic License
Name string // configured beat name
Hostname string // hostname
FQDN string // FQDN
ID uuid.UUID // ID assigned to beat machine
EphemeralID uuid.UUID // ID assigned to beat process invocation (PID)
FirstStart time.Time // The time of the first start of the Beat.
StartTime time.Time // The time of last start of the Beat. Updated when the Beat is started or restarted.
UserAgent string // A string of the user-agent that can be passed to any outputs or network connections
Beat string // The actual beat's name
IndexPrefix string // The beat's index prefix in Elasticsearch.
Version string // The beat version. Defaults to the libbeat version when an implementation does not set a version
ElasticLicensed bool // Whether the beat is licensed under and Elastic License
Name string // configured beat name
Hostname string // hostname
FQDN string // FQDN
ID uuid.UUID // ID assigned to beat machine
EphemeralID uuid.UUID // ID assigned to beat process invocation (PID)
FirstStart time.Time // The time of the first start of the Beat.
StartTime time.Time // The time of last start of the Beat. Updated when the Beat is started or restarted.
UserAgent string // A string of the user-agent that can be passed to any outputs or network connections
FIPSDistribution bool // If the beat was compiled as a FIPS distribution.

// Monitoring-related fields
Monitoring Monitoring
Expand Down
23 changes: 12 additions & 11 deletions libbeat/cmd/instance/beat.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,16 +242,17 @@ func NewBeat(name, indexPrefix, v string, elasticLicensed bool, initFuncs []func

b := beat.Beat{
Info: beat.Info{
Beat: name,
ElasticLicensed: elasticLicensed,
IndexPrefix: indexPrefix,
Version: v,
Name: hostname,
Hostname: hostname,
ID: id,
FirstStart: time.Now(),
StartTime: time.Now(),
EphemeralID: metricreport.EphemeralID(),
Beat: name,
ElasticLicensed: elasticLicensed,
IndexPrefix: indexPrefix,
Version: v,
Name: hostname,
Hostname: hostname,
ID: id,
FirstStart: time.Now(),
StartTime: time.Now(),
EphemeralID: metricreport.EphemeralID(),
FIPSDistribution: version.FIPSDistribution,
},
Fields: fields,
Registry: reload.NewRegistry(),
Expand Down Expand Up @@ -554,7 +555,7 @@ func (b *Beat) createBeater(bt beat.Creator) (beat.Beater, error) {
}

log := b.Info.Logger.Named("beat")
log.Infof("Setup Beat: %s; Version: %s", b.Info.Beat, b.Info.Version)
log.Infof("Setup Beat: %s; Version: %s (FIPS-distribution: %v)", b.Info.Beat, b.Info.Version, b.Info.FIPSDistribution)
b.logSystemInfo(log)

err = b.registerESVersionCheckCallback()
Expand Down
4 changes: 2 additions & 2 deletions libbeat/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@
func(_ *cobra.Command, args []string) error {
beat, err := instance.NewBeat(settings.Name, settings.IndexPrefix, settings.Version, settings.ElasticLicensed, settings.Initialize)
if err != nil {
return fmt.Errorf("error initializing beat: %s", err)

Check failure on line 40 in libbeat/cmd/version.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

non-wrapping format verb for fmt.Errorf. Use `%w` to format errors (errorlint)
}

buildTime := "unknown"
if bt := version.BuildTime(); !bt.IsZero() {
buildTime = bt.String()
}
fmt.Printf("%s version %s (%s), libbeat %s [%s built %s]\n",
fmt.Printf("%s version %s (%s), libbeat %s [%s built %s] (FIPS-distribution: %v)\n",

Check failure on line 47 in libbeat/cmd/version.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

use of `fmt.Printf` forbidden by pattern `fmt.Print.*` (forbidigo)
beat.Info.Beat, beat.Info.Version, runtime.GOARCH, version.GetDefaultVersion(),
version.Commit(), buildTime)
version.Commit(), buildTime, version.FIPSDistribution)
return nil
}),
}
Expand Down
23 changes: 23 additions & 0 deletions libbeat/version/fips.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// 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.

//go:build requirefips

package version

// Set FIPSDistribution to true for FIPS builds.
const FIPSDistribution bool = true
23 changes: 23 additions & 0 deletions libbeat/version/nofips.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// 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.

//go:build !requirefips

package version

// Set FIPSDistribution to false for non-FIPS builds.
const FIPSDistribution bool = false
Loading