Created
January 9, 2024 17:04
-
-
Save ryanhs/73dadfca976bc8802bd6d09c860e2f96 to your computer and use it in GitHub Desktop.
twingate athena
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE EXTERNAL TABLE twingate_logs ( | |
`event_type` string, | |
`event` struct< | |
`time`:string, | |
`action`:string, | |
`actor`:struct<`type`:string,`id`:string>, | |
`targets`:array< | |
struct< | |
`version`:string, | |
`type`:string, | |
`name`:string, | |
`id`:string, | |
`role`:string, | |
`email`:string, | |
`isAdmin`:boolean, | |
`isActive`:boolean, | |
`secureDNSGroupException`:boolean | |
> | |
> | |
> | |
) | |
ROW FORMAT serde 'org.openx.data.jsonserde.JsonSerDe' | |
LOCATION 's3://twingate-admo-reports/'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
event_type, | |
event.time, | |
event.action, | |
event.targets[1].type who_type, | |
event.targets[1].name who_name, | |
event.targets[1].role who_role, | |
event.targets[1].email who_email, | |
event.targets[1].isAdmin isAdmin, | |
event.targets[1].isActive isActive, | |
case | |
when cardinality(event.targets) > 1 | |
then event.targets[2].type | |
else '' | |
end as "on_type", | |
case | |
when cardinality(event.targets) > 1 | |
then event.targets[2].name | |
else '' | |
end as "on_name" | |
from twingate_logs | |
limit 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
still need some work