Skip to content

Commit

Permalink
beats: import time/tzdata explicitly in main (elastic#40420)
Browse files Browse the repository at this point in the history
In order to handle timezones we import Go's own timezone database. This
import is done indirectly by libbeat/common/cfgtype. We trust that this
package will end up being required by the dependency chain of every beats
main binary.

To ensure that the binaries continue to handle timezones correctly and to
avoid any unexpected issues, let's import time/tzdata explicitly in the
main packages.

See elastic#40326.

Co-authored-by: Pierre HILBERT <[email protected]>
  • Loading branch information
mauri870 and pierrehilbert authored Aug 12, 2024
1 parent e4012a2 commit 7b041ba
Show file tree
Hide file tree
Showing 16 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions auditbeat/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package main

import (
"os"
_ "time/tzdata" // for timezone handling

"github.com/elastic/beats/v7/auditbeat/cmd"
)
Expand Down
1 change: 1 addition & 0 deletions filebeat/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package main

import (
"os"
_ "time/tzdata" // for timezone handling

"github.com/elastic/beats/v7/filebeat/cmd"
inputs "github.com/elastic/beats/v7/filebeat/input/default-inputs"
Expand Down
1 change: 1 addition & 0 deletions heartbeat/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package main

import (
"os"
_ "time/tzdata" // for timezone handling

"github.com/elastic/beats/v7/heartbeat/cmd"

Expand Down
1 change: 1 addition & 0 deletions metricbeat/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ package main

import (
"os"
_ "time/tzdata" // for timezone handling

"github.com/elastic/beats/v7/metricbeat/cmd"
)
Expand Down
1 change: 1 addition & 0 deletions packetbeat/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package main

import (
"os"
_ "time/tzdata" // for timezone handling

"github.com/elastic/beats/v7/packetbeat/cmd"
)
Expand Down
1 change: 1 addition & 0 deletions winlogbeat/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ package main

import (
"os"
_ "time/tzdata" // for timezone handling

"github.com/elastic/beats/v7/winlogbeat/cmd"
)
Expand Down
1 change: 1 addition & 0 deletions x-pack/agentbeat/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package main
import (
"fmt"
"os"
_ "time/tzdata" // for timezone handling

"github.com/elastic/beats/v7/libbeat/cfgfile"
"github.com/elastic/beats/v7/libbeat/cmd"
Expand Down
1 change: 1 addition & 0 deletions x-pack/auditbeat/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package main

import (
"os"
_ "time/tzdata" // for timezone handling

"github.com/elastic/beats/v7/x-pack/auditbeat/cmd"
)
Expand Down
1 change: 1 addition & 0 deletions x-pack/dockerlogbeat/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"fmt"
"os"
"strconv"
_ "time/tzdata" // for timezone handling

"github.com/docker/go-plugins-helpers/sdk"

Expand Down
1 change: 1 addition & 0 deletions x-pack/filebeat/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package main

import (
"os"
_ "time/tzdata" // for timezone handling

"github.com/elastic/beats/v7/x-pack/filebeat/cmd"
)
Expand Down
1 change: 1 addition & 0 deletions x-pack/functionbeat/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package main

import (
"os"
_ "time/tzdata" // for timezone handling

_ "github.com/elastic/beats/v7/x-pack/functionbeat/include" // imports features
"github.com/elastic/beats/v7/x-pack/functionbeat/manager/cmd"
Expand Down
1 change: 1 addition & 0 deletions x-pack/heartbeat/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package main

import (
"os"
_ "time/tzdata" // for timezone handling

"github.com/elastic/beats/v7/x-pack/heartbeat/cmd"
)
Expand Down
1 change: 1 addition & 0 deletions x-pack/metricbeat/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ package main

import (
"os"
_ "time/tzdata" // for timezone handling

"github.com/elastic/beats/v7/x-pack/metricbeat/cmd"
)
Expand Down
1 change: 1 addition & 0 deletions x-pack/osquerybeat/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package main

import (
"os"
_ "time/tzdata" // for timezone handling

"github.com/elastic/beats/v7/x-pack/osquerybeat/cmd"
)
Expand Down
1 change: 1 addition & 0 deletions x-pack/packetbeat/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package main

import (
"os"
_ "time/tzdata" // for timezone handling

"github.com/elastic/beats/v7/x-pack/packetbeat/cmd"
)
Expand Down
1 change: 1 addition & 0 deletions x-pack/winlogbeat/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package main

import (
"os"
_ "time/tzdata" // for timezone handling

"github.com/elastic/beats/v7/x-pack/winlogbeat/cmd"
)
Expand Down

0 comments on commit 7b041ba

Please sign in to comment.