Telegraf extract substring for given field string

Hi all. I am having json data in the following format -

Format-1: counters_applevel_A
Format-2: counters_5_A

So in format-2, data can have any integer inplace of 5 like counters_1_A or anything but it will be a integer. Format-1 applevel is permanent. So i am using processor plugin to create a new tag named “cell”;

Format-1: cell = "applevel"
Format-2: cell = "5"

now i want to remove substring counters_${cell} from field. Any ways to achieve this.

[[processors.strings]]
  order = 8
  [[processors.strings.trim_prefix]]
    field_key = "*"
    prefix = "counters_"

Using this i am able to reduce fields to say; applevel_A and 5_A. Now how do i further remove this 5 given that this changes; and that value i am storing in tag called “cell”.

Thanks

Hey @Pratik_Das_Baghel,
I’m a little confused can you help me by sharing your input data and your complete telegraf config?

Hey, thanks for replying. I have figured out the solution. Also i wanted to use starlark processor plugin for performing regular expression. Is that function available?

Hi Pratik ,

i’m too searching for similar requirement ,can i know how did you achieved this

Thanks & Regards ,
Kiran