Another tag rename question

I’m trying to get my head around the processors.rename for a long tag that I’m receiving from inputs.filecount.

My raw data ends up like this:

du,directory=/hostfs/mnt/p/ServerFolders/MachineBackup,host=aragorn count=4146i,size_bytes=2634590168171i 1652814356000000000
du,directory=/hostfs/mnt/p/ServerFolders/MachineBackup,host=aragorn count=4146i,size_bytes=2634590168171i 1652812847000000000
> du,directory=/hostfs/mnt/p/ServerFolders/BackedupSettings,host=aragorn count=9986i,size_bytes=201347817259i 1652812962000000000

So that directory tag is pretty long
So I’ve been trying to remove the /hostfs/mnt/p/ part of it.
I’ve tried a rename of:

[[inputs.filecount]]
  interval = "5m"
  directories = ["/hostfs/mnt/p/ServerFolders/Videos","/hostfs/mnt/p/ServerFolders/MachineBackup","/hostfs/mnt/p/ServerFolders/BackedupSettings" ]
  recursive  = true
  follow_symlinks = false
  name_override = "du"
  name_suffix = ""
  data_format = "json"
  tag_keys = [ "directory" ]

  [[processors.rename]]
    namepass=["du"]
    [[processors.rename.replace]]
      tag ="/hostfs/mnt/p/ServerFolders/Videos"
      dest = "ServerFolders.Videos"
    [[processors.rename.replace]]
      tag ="/hostfs/mnt/p/ServerFolders/MachineBackup"
      dest = "ServerFolders.MachineBackup"
    [[processors.rename.replace]]
      tag ="/hostfs/mnt/p/ServerFolders/BackedupSettings"
      dest = "ServerFolders.BackedupSettings"

Which has the specific names, could the “/” be a problem? I did also try one replace where I had `/hostfs/mnt/p’ replaced with “” but that didn’t seem to trigger either.

Hello @psyciknz,
Have you tried using the “old” and “new” syntax in the toml?

Hello @Anaisdg
I have a similar scenario and want to change the name of the url tags. This is what the inputs.html data looks like:

[[inputs.http]]
  urls = [
    "https://api.forecast.solar/estimate/xx.84333/xx.75358/26/-113/4.380",
    "https://api.forecast.solar/estimate/xx.84333/xx.75358/26/67/2.920"
  ]

Now I followed your link and used the following processor code:

[[processors.strings]]
   [[processors.strings.replace]]
    tag_key = "url"
    old = "https://api.forecast.solar/estimate/xx.84333/xx.75358/26/-113/4.380"
    new = "EastSite"
  [[processors.strings.replace]]
    tag_key = "url"
    old = "https://api.forecast.solar/estimate/xx.84333/xx.75358/26/67/2.920"
    new = "WestSite"

Unfortunately, the URLs are not renamed to “EastSite” and “WestSite” accordingly. What am I doing wrong?