{"id":72653,"date":"2023-04-18T12:20:30","date_gmt":"2023-04-18T12:20:30","guid":{"rendered":"https:\/\/merikebi.warrenmyers.com\/?p=72653"},"modified":"2023-04-18T12:20:30","modified_gmt":"2023-04-18T12:20:30","slug":"answer-by-warren-for-splunk-query-for-rarity-without-ai","status":"publish","type":"post","link":"https:\/\/merikebi.warrenmyers.com\/?p=72653","title":{"rendered":"Answer by warren for Splunk query for rarity without AI"},"content":{"rendered":"<p>I would try something like this:<\/p>\n<pre><code>index=ndx sourcetype=srctp user=* [| inputlookup my_list_of_10_hosts.csv ] earliest=0\n| fields _time user host\n| stats min(_time) as early max(_time) as recent by user host\n| eval early_diff=now()-early\n| where early_diff&lt;604800\n| eval early=strftime(early,&quot;%c&quot;), recent=strftime(recent,&quot;%c&quot;)\n<\/code><\/pre>\n<p>This will go back through all your data (hence the <code>earliest=0<\/code>), and find all the <code>user<\/code>\/<code>host<\/code> combos, noting the earliest and most-recent logins<\/p>\n<p>Then calculate the difference in the <code>early<\/code> time from <code>now()<\/code>, making sure the first time you saw this combo was less than a week ago<\/p>\n<p>from User warren &#8211; Stack Overflow https:\/\/stackoverflow.com\/questions\/76041726\/splunk-query-for-rarity-without-ai\/76044507#76044507<br \/>\nvia <a href=\"https:\/\/ifttt.com\/?ref=da&#038;site=wordpress\">IFTTT<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I would try something like this: index=ndx sourcetype=srctp user=* [| inputlookup my_list_of_10_hosts.csv ] earliest=0 | fields _time user host | stats min(_time) as early max(_time) as recent by user host | eval early_diff=now()-early | where early_diff&lt;604800 | eval early=strftime(early,&quot;%c&quot;), recent=strftime(recent,&quot;%c&quot;) This will go back through all your data (hence the earliest=0), and find all the &hellip;<br \/><a href=\"https:\/\/merikebi.warrenmyers.com\/?p=72653\" class=\"more-link pen_button pen_element_default pen_icon_arrow_double\">Continue reading <span class=\"screen-reader-text\">Answer by warren for Splunk query for rarity without AI<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[991],"keyring_services":[],"class_list":["post-72653","post","type-post","status-publish","format-standard","hentry","category-blih","tag-stackexchange"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/72653","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=72653"}],"version-history":[{"count":1,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/72653\/revisions"}],"predecessor-version":[{"id":72654,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/72653\/revisions\/72654"}],"wp:attachment":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=72653"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=72653"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=72653"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fkeyring_services&post=72653"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}