Add additional information to each point using Custom UDF

kapacitor
#1

I want to grab a batch of data from a database and create a cryptographic hash and add this hash to each point either as tag or a field in another database? Will the provides in the UDF will be a STREAM or BATCH? How do I achieve this?

#2

Hello @shantanoo-desai ,

Are you adding one cryptographic hash tag to a batch of data? or add custom tags to individual points? If it’s the former look here. If you’re interested in the latter look at EvalNode. I’m confused about the second part of your question. Are you looking to output a stream or batch?

Thanks!

#3

Hi @Anaisdg I am in fact looking to grab a batch of data periodically, create a cryptographic hash of the complete batch and add the calculated hash to each of the points of the batch as tag or field.

I would like to then probably, send this batch for some processing.

I was in fact able to create an UDF and have documented here.

I however, within my UDF I want to obtain the batch and then hash it within my UDF and then accordingly send it out.

#4

I wasn’t able to figure out how can I add Crypto Hash to batch of data via Telegraf? Any help on this?

#5

Hello @shantanoo-desai,
Sorry for the delay. I’m not sure how to achieve that with your UDF, I’ll take a longer look at it. You could specify a Global Tag. But since you are looking to add multiple tags, I would handle this in Kapacitor with a TICK Script. You can use EvalNode and the InfluxDBOutNode. In the documentation, the examples are made with stream, but you can change that to batch. Alternatively, I would look into using client libraries if you’re more comfortable with that.

#6

@shantanoo-desai
I’m actually not sure that EvalNode would work (still looks cool though). Looks like someone tried it in this stack overflow question. But I haven’t tried it for myself.

Since you’re already making a UDF, it makes sense to add the tag there (like you said). Please take a look at:


each point has a dictionary of fields and tags

You would have to do something like point.tags["hash"] = <hash>

Thank you for your patience.

#7

@shantanoo-desai Just to be clear and for future reference, EvalNode will allow you add a tag. But you’re right, you need to use a UDF because you need to create the custom cryptographic hash and add it. I hope those links helped.

#8

Thanks Anais. I will look into your suggestions.