Hello,
how to filter following data where topics includes “account”:
[
{
"host": "telegraf",
"message": "package channel changed by winbox-3.41/mac-msg(winbox):admin@[MAC] (/system package update set channel=testing)",
"topics": "system,info",
"time": "2024-08-06T19:19:30.144379267Z"
},
{
"host": "telegraf",
"message": "package channel changed by winbox-3.41/mac-msg(winbox):admin@[MAC] (/system package update set channel=stable)",
"topics": "system,info",
"time": "2024-08-06T19:19:30.144402187Z"
},
{
"host": "telegraf",
"message": "user admin logged out from [MAC] via winbox",
"topics": "system,info,account",
"time": "2024-08-06T19:19:30.144408939Z"
},
{
"host": "telegraf",
"message": "[MAC]@cap-wifi5 disconnected, connection lost, signal strength -62",
"topics": "wireless,info",
"time": "2024-08-06T19:19:30.144423912Z"
},
{
"host": "telegraf",
"message": "[MAC]@cap-wifi5 disconnected, connection lost, signal strength -61",
"topics": "wireless,info",
"time": "2024-08-06T19:24:04.303321525Z"
},
{
"host": "telegraf",
"message": "[MAC]@cap-wifi5 connected, signal strength -58",
"topics": "wireless,info",
"time": "2024-08-06T19:27:07.026508692Z"
},
{
"host": "telegraf",
"message": "[MAC]@cap-wifi5 disconnected, connection lost, signal strength -59",
"topics": "wireless,info",
"time": "2024-08-06T19:32:07.925011338Z"
},
{
"host": "telegraf",
"message": "[MAC]@cap-wifi5 connected, signal strength -58",
"topics": "wireless,info",
"time": "2024-08-06T19:33:44.969242904Z"
},
{
"host": "telegraf",
"message": "[MAC]@cap-wifi5 disconnected, connection lost, signal strength -62",
"topics": "wireless,info",
"time": "2024-08-06T19:38:57.649835972Z"
}
]
I tried the following:
import "strings"
from(bucket: "myBucket")
|> range(start: -1d)
|> filter(fn: (r) => contains(set: ["topics", "message"], value: r._field))
|> filter(fn: (r) => strings.containsStr(v: r._value, substr: "account") == true)
then I only get the where topics and message includes “account”, but I want to filter only topics and want to see the message which has the topic included. Anyone know my mistake? I think Im doing something heavily wrong