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

Telegraf Line protocol import error - Tag value with escaped spaces #4426

Closed
mickymots opened this issue Jul 16, 2018 · 2 comments · Fixed by #5484
Closed

Telegraf Line protocol import error - Tag value with escaped spaces #4426

mickymots opened this issue Jul 16, 2018 · 2 comments · Fixed by #5484
Assignees
Labels
bug unexpected problem or unintended behavior
Milestone

Comments

@mickymots
Copy link

mickymots commented Jul 16, 2018

Relevant telegraf.conf:

Telegraf Configuration

[global_tags]
# Configuration for telegraf agent
[agent]
  ## Default data collection interval for all inputs
  interval = "60s"
  round_interval = true
  metric_batch_size = 1000

  metric_buffer_limit = 10000

  collection_jitter = "0s"

  flush_interval = "10s"
  flush_jitter = "0s"

  precision = "ns"

  hostname = ""
  omit_hostname = false

###############################################################################
#                            OUTPUT PLUGINS                                   #
###############################################################################

# Configuration for sending metrics to InfluxDB
[[outputs.influxdb]]
  urls = ["http://127.0.0.1:8086"]
  database = "_influxdb"

###############################################################################
#                            INPUT PLUGINS                                    #
###############################################################################

# Read metrics from one or more commands that can output to stdout
[[inputs.exec]]
  ## Commands array
  commands = [
    "/home/amit/telegraf/import.sh"
  ]

  ## Timeout for each command to complete.
  timeout = "60s"

  ## measurement name suffix (for separating different commands)
  # name_suffix = ""

  data_format = "influx"

 # Measurement name
  name_override = "oozie"

System info:

[Include Telegraf version, operating system name, and other relevant details]

Steps to reproduce:

  1. /create a script to output below line:
ooziecoord,coordJobName=AMI\\ CPAT\\ Omniture\\ Validation\\ Coordinator,status=SUCCEEDED coordJobName="AMI\\ CPAT\\ Omniture\\ Validation\\ Coordinator",status="SUCCEEDED",nextMaterializedTimeInMillis=1529874000000,dateStartTimeInMillis=1529640000000,dateEndTimeInMillis=1529812800000 1529874000000000000
  1. configure telegraf as per the config given above

Expected behavior:

data gets imported in _influxdb

Actual behavior:

An Error is thrown:

Error in plugin [inputs.exec]: metric parse error: expected field at offset 26934:

Additional info:

data can be imported successfully using infludbDB cli import command:

step 1. create a data file (datarrr.txt) with the following lines:

# DDL
CREATE DATABASE _influxdb
# DML
# CONTEXT-DATABASE: _influxdb

ooziecoord,coordJobName=AMI\\ CPAT\\ Omniture\\ Validation\\ Coordinator,status=SUCCEEDED coordJobName="AMI\\ CPAT\\ Omniture\\ Validation\\ Coordinator",status="SUCCEEDED",nextMaterializedTimeInMillis=1529874000000,dateStartTimeInMillis=1529640000000,dateEndTimeInMillis=1529812800000 1529874000000000000

Step 2 - run command

influx -import -path=datarrr.txt -precision=ns

Step 3 - Verify data is present in _influxdb

@danielnelson
Copy link
Contributor

Thanks for the report, assuming you don't want the tag value to have backslashes in it, you can use a single backslash:

coordJobName=AMI\ CPAT\ Omniture\ Validation\ Coordinator

I suggest moving to this style even when this bug is fixed.

@danielnelson danielnelson added the bug unexpected problem or unintended behavior label Jul 16, 2018
@danielnelson danielnelson self-assigned this Nov 12, 2018
@danielnelson danielnelson added this to the 1.10.0 milestone Nov 12, 2018
@danielnelson
Copy link
Contributor

Also need to take a look at the production of line protocol with this escaping:

acc.AddFields("test", map[string]interface{}{"value": int64(42)}, map[string]string{"id": `PS\ Old\ Gen`})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants