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

Timestamp not being parsed correctly #10902

Closed
tgirotto opened this issue Mar 28, 2022 · 0 comments
Closed

Timestamp not being parsed correctly #10902

tgirotto opened this issue Mar 28, 2022 · 0 comments
Labels
area/influxdb bug unexpected problem or unintended behavior

Comments

@tgirotto
Copy link

tgirotto commented Mar 28, 2022

Basically I am really just replicating the example at https://github.com/influxdata/telegraf/blob/master/plugins/parsers/json_v2/testdata/object_timestamp/input.json

Relevant telegraf.conf

# Read formatted metrics from one or more HTTP endpoints
[[inputs.http_listener_v2]]
  #name_override = "Example"

  ## Address and port to host HTTP listener on
  service_address = ":8085"

  ## Path to listen to.
  path = "/example"

  ## HTTP methods to accept.
  methods = ["POST", "PUT"]

  ## maximum duration before timing out read of the request
  # read_timeout = "10s"
  ## maximum duration before timing out write of the response
  # write_timeout = "10s"

  ## Maximum allowed http request body size in bytes.
  ## 0 means to use the default of 524,288,000 bytes (500 mebibytes)
  # max_body_size = "500MB"

  ## Set one or more allowed client CA certificate file names to
  ## enable mutually authenticated TLS connections
  # tls_allowed_cacerts = ["/etc/telegraf/clientca.pem"]

  ## Add service certificate and key
  # tls_cert = "/etc/telegraf/cert.pem"
  # tls_key = "/etc/telegraf/key.pem"

  ## Optional username and password to accept for HTTP basic authentication.
  ## You probably want to make sure you have TLS configured above for this.
  basic_username = "xxxx"
  basic_password = "yyyyyy"

  ## Data format to consume.
  ## Each data format has its own unique set of configuration options, read
  ## more about them here:
  ## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
  #data_format = "json"

  #Parse `stationBeanList` array only
  #json_query = "data"

  #Exclude url and host items from tags
  #tagexclude = ["url", "host"]

  #Set station metadata as tags
  data_format = "json_v2"

  [[inputs.http_listener_v2.json_v2]]
    measurement_name = "totals"
    
    [[inputs.http_listener_v2.json_v2.object]]
        path = "events"
        tags = ["id"]
        timestamp_key = "time"
        timestamp_format = "2006-01-02T15:04:05Z"

Logs from Telegraf

2022-03-25T17:35:45Z D! [outputs.influxdb_v2] Buffer fullness: 0 / 10000 metrics
2022-03-25T17:35:55Z D! [outputs.influxdb_v2] Wrote batch of 1 metrics in 144.280252ms

System info

Linux a7426996f158 4.15.0-173-generic #182-Ubuntu SMP Fri Mar 18 15:53:46 UTC 2022 x86_64 GNU/Linux, Docker version 20.10.7, build 20.10.7-0ubuntu5~18.04.3,

Docker

No response

Steps to reproduce

Input:

{
    "events": [
        {
            "id": 100,
            "value": 100.123,
            "time": "2022-03-28T11:36:00Z"
        },
    ]
}

Expected behavior

The timestamp should be parsed to 2022-03-28T11:36:00.000000000Z

Actual behavior

The timestamp is parsed to 2022-03-28T11:30:35.266464381Z

Additional info

No response

@tgirotto tgirotto added the bug unexpected problem or unintended behavior label Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/influxdb bug unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

1 participant