Hi folks,
I’m trying to put all the metrics captured by this plugin (OPC UA) in its own dedicated bucket.
To do this I was thinking of using the “tagpass” filter.
Thank @jpowers,
So I just use the “namepass = [” OPCUA “]” filter to filter the previous metrics.
I still don’t understand how the “tagpass” filter works.
Can I ask you for an example or is there any other documentation about it?
opcua is the measurement name and you can filter out that metric using the namepass or namedrop config option. It will look at the value of the measurment name itself.
id is the only tag in this example. With tagpass or tagdrop we can filter metrics that have the id tag with a specific value. So:
[outputs.influxdb_v2.tagpass]
id = "ns=6;s=::AsGlobalPV:bBlink50ms"
Would pass the above example, but if the value of id is any different it will not.
I want to put all the OPC UA plugin metrics in a bucket, in this case using tagpass.
Now Metrics are not written to its dedicated bucket with this filter.
[outputs.influxdb_v2.tagpass]
tag = ["host"]
these are my outputs
# Only OPC UA metrics should go here
[[outputs.influxdb_v2]]
urls = ["http://127.0.0.1:8086"]
token = "token"
organization = "xxx"
## Destination bucket to write into.
bucket = "OPCUA"
[outputs.influxdb_v2.tagpass]
tag = ["host"]
# All the metrics go here
[[outputs.influxdb_v2]]
urls = ["http://127.0.0.1:8086"]
token = "token"
organization = "xxx"
## Destination bucket to write into.
bucket = "ALL"
[[outputs.file]]
files = ["./tmp/metrics.out"]
data_format = "influx"
rotation_interval = "24h"
rotation_max_archives = 10
I think the easiest way to pass all metrics from a certain input, like OPCUA, is to use the namepass option instead.
namepass = ["OPCUA"]
This way if another measurement happens to have a “host” tag, does not also get added.
I have to admit I’ve made a mistake on my tagpass definition above (I’ve updated my above comment as well):
[outputs.influxdb_v2.tagpass]
tag = ["host"]
This will look for a tag key called “tag” with the value “host”:
# this will get added
OPCUA,tag=host,id=ns\=6;s\=::AsGlobalPV:bBlink50ms bBlink50ms=false,Quality="OK (0x0)" 1664288460000000000
# this will not
OPCUA,host=PC-1,id=ns\=6;s\=::AsGlobalPV:bBlink50ms bBlink50ms=false,Quality="OK (0x0)" 1664288460000000000
I think you were trying to do something like this:
[outputs.influxdb_v2.tagpass]
host = ["PC-1"]
But again this will push any metric with a tag that is host="PC-1"
Thank you very much I finally managed to use the tagpass filter
You should add the square brackets in the post you edited otherwise, it returns a TOML sintax error because it expects an array of admissible values
The only point I have yet to open is this:
This filter still don’t understand why it doesn’t work