GAM alerts query filter syntax

89 views
Skip to first unread message

Santiago Peltzer

unread,
Jul 11, 2023, 2:30:57 PM7/11/23
to GAM for Google Workspace
Hi, im trying to use an alert query filter in a script but im strugling with quoting.

Found an old conversation stating that the whole filter should be wraped in single quotes.

> filter_string="'source=\"Gmail phishing\" AND createTime > \"$(date +%FT%TZ -d '-7 days')\"'"

> echo $filter_string

'source="Gmail phishing" AND createTime > "2023-07-03T20:45:52Z"'

> gam show alerts filter $filter_string

Command: gam show alerts filter "'source="Gmail" >>>phishing"<<< AND createTime > ""2023-07-03T20:47:23Z"'"

Thanks

Ross Scroggs

unread,
Jul 12, 2023, 6:02:32 PM7/12/23
to google-ap...@googlegroups.com
Santiago,

Try:

date_string=$(date +%FT%TZ -d "-7 days")

filter_string="source=\"Gmail phishing\" AND createTime > \"$date_string\""

gam show alerts filter "$filter_string"

Ross


--
You received this message because you are subscribed to the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/9058da6f-9e92-4bbe-b26a-753057eb6922n%40googlegroups.com.


--
Reply all
Reply to author
Forward
0 new messages