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

JSON parser: how to handle data with missing time keys #6532

Closed
russorat opened this issue Oct 16, 2019 · 1 comment · Fixed by #6536
Closed

JSON parser: how to handle data with missing time keys #6532

russorat opened this issue Oct 16, 2019 · 1 comment · Fixed by #6536
Labels
feature request Requests for new plugin and for new features to existing plugins
Milestone

Comments

@russorat
Copy link
Contributor

Feature Request

Opening a feature request kicks off a discussion.

Proposal:

Add a way to handle json data with missing time keys

Current behavior:

json parsing fails the entire document

Desired behavior:

  1. the json parser should have a more helpful error message than "JSON time key could not be found". Ideally it would print the record it failed on
  2. there could be a config option to ignore records with missing time keys, or an option to use a default time for missing time keys

Use case:

extends the capability of the json parser. enables more json files to be parsed without the need for custom application logic.

[[inputs.http]]
  interval = "10s"
  urls = [
    "https://data.nasa.gov/resource/y77d-th95.json"
  ]
  name_override = "meteorevent"
  method = "GET"
  timeout = "5s"
  data_format = "json"
  json_query = ""
  tag_keys = [
    "nametype",
    "recclass",
    "fall",
    "geolocation_latitude",
    "geolocation_longitude",
    "year"
  ]
  json_string_fields = [
    "name",
    "id"
  ]
  json_name_key = ""
  json_time_key = "year"
  json_time_format = "2006-01-02T15:04:05.000"
@rawkode
Copy link
Contributor

rawkode commented Oct 16, 2019

I don't think using the current time, in the event of a missing key, would ever be the intended behaviour (IMO)

I think by default the parser should continue on error, rather than rejecting the whole file. Perhaps change the default behaviour to that, but as a strict flag to revert to the current behaviour?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Requests for new plugin and for new features to existing plugins
Projects
None yet
3 participants