Skip to content

Commit

Permalink
Changed CreationDate to string to prevent scientific notation convers…
Browse files Browse the repository at this point in the history
…ion (#42053)

* Changed CreationDate to string to prevent scientific notation conversion

* Added changelog entry

* Make update

(cherry picked from commit b185b11)
  • Loading branch information
3kt authored and mergify[bot] committed Dec 17, 2024
1 parent 7bcaedb commit 7bd09e1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- Add missing ECS Cloud fields in GCP `metrics` metricset when using `exclude_labels: true` {issue}40437[40437] {pull}40467[40467]
- Add AWS OwningAccount support for cross account monitoring {issue}40570[40570] {pull}40691[40691]
- Use namespace for GetListMetrics when exists in AWS {pull}41022[41022]
- Fix http server helper SSL config. {pull}39405[39405]
- Fix Kubernetes metadata sometimes not being present after startup {pull}41216[41216]
- Do not report non-existant 0 values for RSS metrics in docker/memory {pull}41449[41449]
- Log Cisco Meraki `getDevicePerformanceScores` errors without stopping metrics collection. {pull}41622[41622]
- Don't skip first bucket value in GCP metrics metricset for distribution type metrics {pull}41822[41822]
- Fixed `creation_date` scientific notation output in the `elasticsearch.index` metricset. {pull}42053[42053]


*Osquerybeat*

Expand Down
8 changes: 2 additions & 6 deletions metricbeat/module/elasticsearch/index/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package index
import (
"encoding/json"
"fmt"
"strconv"

"github.com/joeshaw/multierror"

Expand All @@ -44,7 +43,7 @@ type Index struct {
Index string `json:"index"`
Status string `json:"status"`
TierPreference string `json:"tier_preference"`
CreationDate int `json:"creation_date"`
CreationDate string `json:"creation_date"`
Version string `json:"version"`
Shards shardStats `json:"shards"`
}
Expand Down Expand Up @@ -307,10 +306,7 @@ func addIndexSettings(idx *Index, indicesSettings mapstr.M) error {
return fmt.Errorf("failed to get index creation date: %w", err)
}

idx.CreationDate, err = strconv.Atoi(indexCreationDate)
if err != nil {
return fmt.Errorf("failed to convert index creation date to int: %w", err)
}
idx.CreationDate = indexCreationDate

indexTierPreference, err := getIndexSettingForIndex(indexSettings, idx.Index, "index.routing.allocation.require._tier_preference")
if err != nil {
Expand Down

0 comments on commit 7bd09e1

Please sign in to comment.