I like this option, as it allows calculation of the effective registered domain using a wildcard lookup based on the PublicSuffixList. | makeresults format=json data="[{\"id\": 1, \"domain\": [\"test.com\",\"sample.com\",\"example.co.uk\", \"nxdomain\"]}, {\"id\": 2, \"domain\": [\"www.example.com\"]}]" | spath path="domain{}" output=domain | eval domain=mvappend(domain, "") ``` append empty string to force to mv field ``` | foreach mode=multivalue domain [ eval domain_segment_len=mvappend( domain_segment_len, json_extract( lookup( "wildcard_public_suffix_list", json_object("tld_wildcard", '<<ITEM>>'), json_array("length") ), "length" ) ), domain_split = mvappend(domain_split, split('<<ITEM>>', ".")) ``` Use mvcount, mvappend, case, and mvjoin to create the effective TLD ``` ] Although not a single command, using a macro like this with builtin lookups is more scalable for large inputs than using an external lookup that generates the effective TLD or registered domain.
... View more