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

CSV parsing issue #10366

Closed
miurlit opened this issue Jan 3, 2022 · 11 comments · Fixed by #10575
Closed

CSV parsing issue #10366

miurlit opened this issue Jan 3, 2022 · 11 comments · Fixed by #10575
Assignees

Comments

@miurlit
Copy link

miurlit commented Jan 3, 2022

Since version 1.21 there seems to be an issue with CSV files, I am getting a parsing error:

Jan 3 02:14:20 raspberrypi telegraf[426]: 2022-01-03T01:14:20Z E! [inputs.file] Error in plugin: parsing time "dd/MM/yyyy HH:mm:ss z" as "02/01/2006 15:04:05 -0700": cannot parse "dd/MM/yyyy HH:mm:ss z" as "02"

If revert back to 1.20.4 no error occurs with the same CSV file.

Thanks

@jonilala796
Copy link

jonilala796 commented Jan 8, 2022

I have the same problem. Going down the version to 1.20.4 also fixed it.
Here is the config for the input I use:

[[inputs.file]]

files = ["/path/to/file.csv"]
name_override = "custom"
data_format = "csv"
csv_header_row_count = 1
csv_delimiter = ";"
csv_timestamp_column = "dd/MM/yyyy HH:mm:ss"
csv_timestamp_format = "02/01/2006 15:04:05"
csv_timezone = "Europe/Berlin"

@gwlqt
Copy link

gwlqt commented Jan 19, 2022

I have the same problem with version 1.21.2. Fixed by downgrading to 1.20.4.

Logs:
E! [inputs.http::alias] Error in plugin: [url=http://]: strconv.ParseInt: parsing "TimeInt": invalid syntax

Config:

[[inputs.http]]
  urls = ["http://"]
  data_format = "csv"
  csv_delimiter = ";"
  csv_header_row_count = 1
  csv_tag_columns = [""]
  csv_timestamp_column = "TimeInt"
  csv_timestamp_format = "unix"

@sspaink
Copy link
Contributor

sspaink commented Jan 19, 2022

Can you provide a CSV file your trying to parse so we can reproduce this issue? There were changes made to the parser from v1.20->v1.21, but it isn't obvious what is causing this issue at first glance.

@gwlqt
Copy link

gwlqt commented Jan 20, 2022

Here is a CSV file: example.csv.
Thanks for looking into this!

@sspaink
Copy link
Contributor

sspaink commented Jan 20, 2022

I think I found the problem in this PR: #10484, it only happens when you run Gather twice the second time the code accidentally changed the configured csv_header_row_count so it would try to parse the header as data. There is still some issue with some of the test expecting the configured value to change that I need to work through.

@miurlit
Copy link
Author

miurlit commented Jan 30, 2022

Sorry, but it seems the issue still persists in 1.21.3?!
I still geht the same error as in my original post...

@jonilala796
Copy link

Yeah the PR was closed without any actions taken.
Here is the sample data from me: https://pastebin.com/VD4r5U8x

@powersj
Copy link
Contributor

powersj commented Jan 30, 2022

@miurlit @jonilala796,

Thanks, we know it is still an open issue. The PR discovered it will require a different approach to fix so it was closed.

@miurlit
Copy link
Author

miurlit commented Jan 30, 2022

@miurlit @jonilala796,

Thanks, we know it is still an open issue. The PR discovered it will require a different approach to fix so it was closed.

Ok, thanks for clarifying.

@srebhan
Copy link
Member

srebhan commented Feb 3, 2022

Hey @miurlit, @jonilala796 @gwlqt, I cooked up an approach in #10575 and would be happy to get feedback if that solves your issues!?!? Could you please add a comment to the PR on your results? Thanks!

@miurlit
Copy link
Author

miurlit commented Feb 26, 2022

@srebhan sorry, was not actively following this conversation, but I am afraid that the issue still persists with the latest release (1.21.4)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants