Import JSON file and stop

Good morning,

I want to import a file containing JSON, I can write to database, but Telegraf loop on the file and spam my database.

I wish he’d add the file once and stop right after.

My config :

commands = [
“python3 /Path/ -n $DOMAIN”

timeout = “90s”

name_suffix = “jmeterResult”

data_format = “json”

tag_keys = [

Thanks for your help

Does the file change or is it the same? Is the command python3 /Path/ -n $DOMAIN printing the contents of the file you are asking about or are you asking how to add that new file as an input?

python3 /Path/ -n $DOMAIN return the content of the file.

My file is generated each hour, so i configure the interval in 1h.

Do you know how i can choose the primary key in influxdatabase to remove the time column ?

Ok great, so you were able to resolve your original issue (file spamming your db) by configuring the interval? I am not sure how to drop a field without a parser, maybe someone else knows a better way.

You can’t remove the time column in InfluxDB, all data is stored/ordered by time.

Yes @glinton :smiley:

@daniel i want to specify my time, but np i create column with timestamp of execution

Glad you have a working solution, you can’t set a timestamp directly using data_format = "json" today, but I anticipate it will be complete in version 1.8.0 with this change:


How can I set it ? i don’t find the configuration

Sorry about the confusion, it can’t be done yet, but keep an eye on the linked issue though if you would like to track progress of the implementation.