Can't insert timestamp in influx

Hello everyone,

I’m struggling with inserting timestamp in influxdb.

This is example of json log
{"@timestamp":"2022-12-26T04:27:24-05:00","client_ip":"xx.xx.xx.xx","domain":" somedomain.com ","request":"/404","responsetime":"0.001","host":"xx.xx.xx.xx","status":"404"}

And this is my input.plugin

[[inputs.tail]]
 files = ["/var/log/nginx/json.access.log"]
 from_beginning = true 
 name_override = "nginxjson"
 json_name_key = "nginxjson"
 data_format = "json"
 json_time_key = "@timestamp"
 json_time_format = "2006-01-02T15:04:05Z07:00"
 tag_keys = ["client_ip", "domain", "request", "host", "status"]
 json_string_fields = ["@timestamp", "responsetime"]

I’ve tried also with timestamp as tag, but same, no errors and timestamp doesn’t write to influxdb, nothing happens, every other field or string is inserting normally. Can someone help?

Can anyone help? I’ve tried so many different approaches and nothing helped

Hello @thenemesis584,
Can you please share some of the log? Thank you.
I don’t think you can insert a timestamp if there isn’t one already.
@Jay_Clifford is also a telegraf expert.

Also what errors are you getting?

HI @thenemesis584,
did you manage to solve this in Slack with grok?

Hello.

Sorry, I wasn’t online for a few days. Yes, I’ve solved it with grok pattern eventually, json data format not working so I gave up on that.

Now I’m trying to solve problem with tail plugin. I’ve found that tail doesn’t work with rotated files and I see that a lot of people have the same problem. The solution that others use is to restart telegraf after log rotation occurs.