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

Error running agent: json_strict is not defined #6906

Closed
VitaliyBreslavskyi opened this issue Jan 15, 2020 · 4 comments · Fixed by #6909
Closed

Error running agent: json_strict is not defined #6906

VitaliyBreslavskyi opened this issue Jan 15, 2020 · 4 comments · Fixed by #6909
Assignees
Labels
area/json json and json_v2 parser/serialiser related bug unexpected problem or unintended behavior
Milestone

Comments

@VitaliyBreslavskyi
Copy link

Hi @rawkode,

Submitting this bug report as requested in #6536
Could you please have a look?

Best regards,
Vitaliy

telegraf_1       | 2020-01-15T13:28:05Z I! Starting Telegraf 1.13.0
telegraf_1       | 2020-01-15T13:28:05Z I! Using config file: /etc/telegraf/telegraf.conf
telegraf_1       | 2020-01-15T13:28:05Z E! [telegraf] Error running agent: Error parsing /etc/telegraf/telegraf.d/input_json.conf, line 37: field corresponding to `json_strict' is not defined in file.File
tick-sandbox_telegraf_1 exited with code 1

Relevant telegraf.conf:

[[inputs.file]]
  files = ["example"]

  ## 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"

  ## When strict is true and a JSON array is being parsed, all objects within the
  ## array must be valid
  json_strict = false

  ## Query is a GJSON path that specifies a specific chunk of JSON to be
  ## parsed, if not specified the whole document will be parsed.
  ##
  ## GJSON query paths are described here:
  ##   https://github.com/tidwall/gjson/tree/v1.3.0#path-syntax
  json_query = ""

  ## Tag keys is an array of keys that should be added as tags.  Matching keys
  ## are no longer saved as fields.
  tag_keys = [
    "my_tag_1",
    "my_tag_2"
  ]

  ## Array of glob pattern strings keys that should be added as string fields.
  json_string_fields = []

  ## Name key is the key to use as the measurement name.
  json_name_key = ""

  ## Time key is the key containing the time that should be used to create the
  ## metric.
  json_time_key = ""

  ## Time format is the time layout that should be used to interprete the json_time_key.
  ## The time must be `unix`, `unix_ms`, `unix_us`, `unix_ns`, or a time in the
  ## "reference time".  To define a different format, arrange the values from
  ## the "reference time" in the example to match the format you will be
  ## using.  For more information on the "reference time", visit
  ## https://golang.org/pkg/time/#Time.Format
  ##   ex: json_time_format = "Mon Jan 2 15:04:05 -0700 MST 2006"
  ##       json_time_format = "2006-01-02T15:04:05Z07:00"
  ##       json_time_format = "01/02/2006 15:04:05"
  ##       json_time_format = "unix"
  ##       json_time_format = "unix_ms"
  json_time_format = ""

  ## Timezone allows you to provide an override for timestamps that
  ## don't already include an offset
  ## e.g. 04/06/2016 12:41:45
  ##
  ## Default: "" which renders UTC
  ## Options are as follows:
  ##   1. Local               -- interpret based on machine localtime
  ##   2. "America/New_York"  -- Unix TZ values like those found in https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  ##   3. UTC                 -- or blank/unspecified, will return timestamp in UTC
  json_timezone = ""
@VitaliyBreslavskyi
Copy link
Author

I've also tried just "strict" (as mentioned in readme) with same result:

telegraf_1       | 2020-01-15T13:17:53Z I! Starting Telegraf 1.13.0
telegraf_1       | 2020-01-15T13:17:53Z I! Using config file: /etc/telegraf/telegraf.conf
telegraf_1       | 2020-01-15T13:17:53Z E! [telegraf] Error running agent: Error parsing /etc/telegraf/telegraf.d/input_json.conf, line 37: field corresponding to `strict' is not defined in file.File

@VitaliyBreslavskyi
Copy link
Author

VitaliyBreslavskyi commented Jan 15, 2020

Please note that this is just an additional file included in "telegraf.d" folder, main config file is basic as in documentation.

@danielnelson danielnelson self-assigned this Jan 15, 2020
@danielnelson danielnelson added area/json json and json_v2 parser/serialiser related bug unexpected problem or unintended behavior labels Jan 15, 2020
@danielnelson danielnelson added this to the 1.13.2 milestone Jan 15, 2020
@danielnelson
Copy link
Contributor

@VitaliyBreslavskyi It doesn't look like this feature was fully wired in, so you won't be able to use it just yet, but we will fix in the next patch release.

@VitaliyBreslavskyi
Copy link
Author

Thank you @danielnelson, good luck with that and have a nice day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/json json and json_v2 parser/serialiser related bug unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants