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

Tag value cannot end with \ #7558

Closed
Trovalo opened this issue May 21, 2020 · 7 comments · Fixed by #7652
Closed

Tag value cannot end with \ #7558

Trovalo opened this issue May 21, 2020 · 7 comments · Fixed by #7652
Labels
area/influxdb bug unexpected problem or unintended behavior
Milestone

Comments

@Trovalo
Copy link
Collaborator

Trovalo commented May 21, 2020

This can be tried just by using Chronograf or any other means to write points (so is probably related to InfluxDB and not with telegraf)

System info:

OS: Windows 10
InfluxDB: 1.8

Steps to reproduce:

Just try to write the following points

#this does not work (ends with backslash)
Test, Tag1=C:\\,Tag2=Something Field1=10
#this works (ends with space)
Test,Tag1=C:\\\ ,Tag2=Something Field1=10

Expected behavior:

being able to write tags that end with "\"

Actual behavior:

A point with a tag that ends with "\" cannot be written (a path could end with the backslash in windows), but other escaped chars are valid (ie: space).
The error is: invalid tag format

Additional info:

I'm not sure this is a telegraf related problem, it might be related to InfluxDB itself

@Trovalo Trovalo changed the title Tag value cannot end with \\ Tag value cannot end with \ May 21, 2020
@danielnelson
Copy link
Contributor

This is a known limitation of InfluxDB Line Protocol: influxdata/influxdb#6154. I'm not sure when it will be addressed, but probably not in the near term.

It may be best to run paths through the strings or the upcoming filepath converter and switch to forward slash.

@danielnelson danielnelson added area/influxdb bug unexpected problem or unintended behavior labels May 21, 2020
@Trovalo
Copy link
Collaborator Author

Trovalo commented May 22, 2020

thanks, that looks like a nice workaround, I was thinking about appending a space the end of the string in order to keep the path as is and also have valid line protocol value

@danielnelson
Copy link
Contributor

Maybe it would make sense to apply one of these workarounds automatically. Perhaps, stripping trailing slashes would look better? C:\ -> C:?

Adding a space works as well, I just wonder if it will cause confusion since it is difficult to notice the space.

@Trovalo
Copy link
Collaborator Author

Trovalo commented May 22, 2020

I did something like that in the SQL Server input plugin (for the new queries), but it's not that easy to remove all the trailing "\" (at least using TSQL) and as of now only the last one is removed (I see no way for a path to end with a double backslash... but you never know) therefore it's probably easier and also safer to just add a space as trailing char if the string end with "\".

This of course is just one case, in general it might just be better to remove the trailing char

@danielnelson
Copy link
Contributor

I think if we add a space it might be confusing, you might not notice it exists and once you do you need to figure out how to escape it in queries. So I think we should either strip the \ or replace it with an underscore.

@Trovalo
Copy link
Collaborator Author

Trovalo commented Jun 8, 2020

As of now, in the SQL Server plugin, the trailing \ will be removed from the string

@danielnelson
Copy link
Contributor

I ended up stripping the trailing \ in #7652.

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

Successfully merging a pull request may close this issue.

2 participants