{"id":26049,"date":"2020-12-01T22:03:00","date_gmt":"2020-12-01T22:03:00","guid":{"rendered":"https:\/\/merikebi.warrenmyers.com\/?p=26049"},"modified":"2020-12-01T22:03:00","modified_gmt":"2020-12-01T22:03:00","slug":"answer-by-warren-for-how-to-make-a-dynamic-span-for-a-timechart","status":"publish","type":"post","link":"https:\/\/merikebi.warrenmyers.com\/?p=26049","title":{"rendered":"Answer by warren for How to make a dynamic span for a timechart?"},"content":{"rendered":"<p>@<a href=\"https:\/\/stackoverflow.com\/users\/2227420\/richg\">RichG<\/a>&#8216;s <a href=\"https:\/\/stackoverflow.com\/a\/65097682\/4418\">answer<\/a> is correct &#8211; but doesn&#8217;t address your core issue, which is wanting to set a specific <code>span=<\/code> for any given selected timeframe.<\/p>\n<p>If you&#8217;re doing this on a &quot;splunk dashboard&quot;, you can control <em>a lot<\/em> about how your search works by using tokens.<\/p>\n<h3>Create a custom time selector as a dropdown that you populate with your <em>own<\/em> choices<\/h3>\n<p>I do this to control just what users can select.<\/p>\n<p>You might have, for example:<\/p>\n<ul>\n<li>10m<\/li>\n<li>1h<\/li>\n<li>1d<\/li>\n<li>1w<\/li>\n<li>1mo<\/li>\n<\/ul>\n<h3>Make those are <em>their own static entries<\/em> in a dropdown:<\/h3>\n<p><a href=\"https:\/\/i.stack.imgur.com\/mdCrM.png\" rel=\"nofollow noreferrer\"><img decoding=\"async\" src=\"https:\/\/i.stack.imgur.com\/mdCrM.png\" alt=\"enter image description here\" \/><\/a><\/p>\n<p><a href=\"https:\/\/i.stack.imgur.com\/qvHsA.png\" rel=\"nofollow noreferrer\"><img decoding=\"async\" src=\"https:\/\/i.stack.imgur.com\/qvHsA.png\" alt=\"enter image description here\" \/><\/a><\/p>\n<p>Then edit the source, and add some <a href=\"https:\/\/docs.splunk.com\/Documentation\/Splunk\/8.1.0\/Viz\/tokens#Conditional_operations_with_form_inputs\" rel=\"nofollow noreferrer\"><code>condition<\/code><\/a> entries that set a <em>second token<\/em> you&#8217;ll use in your search later:<\/p>\n<p><a href=\"https:\/\/i.stack.imgur.com\/ePmOr.png\" rel=\"nofollow noreferrer\"><img decoding=\"async\" src=\"https:\/\/i.stack.imgur.com\/ePmOr.png\" alt=\"enter image description here\" \/><\/a><\/p>\n<h3>In your search, use the tokens thusly:<\/h3>\n<p><a href=\"https:\/\/i.stack.imgur.com\/pSGzs.png\" rel=\"nofollow noreferrer\"><img decoding=\"async\" src=\"https:\/\/i.stack.imgur.com\/pSGzs.png\" alt=\"enter image description here\" \/><\/a><\/p>\n<p>You can now control both the <em>timeframe used<\/em>, <strong>and<\/strong> the <em>span displayed<\/em> in your visualization.<\/p>\n<p>Of course &#8211; name your tokens better, make as many entries as you need, etc.<\/p>\n<p>from User warren &#8211; Stack Overflow https:\/\/stackoverflow.com\/questions\/65096655\/how-to-make-a-dynamic-span-for-a-timechart\/65099199#65099199<br \/>\nvia <a href=\"https:\/\/ifttt.com\/?ref=da&#038;site=wordpress\">IFTTT<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>@RichG&#8216;s answer is correct &#8211; but doesn&#8217;t address your core issue, which is wanting to set a specific span= for any given selected timeframe. If you&#8217;re doing this on a &quot;splunk dashboard&quot;, you can control a lot about how your search works by using tokens. Create a custom time selector as a dropdown that you &hellip;<br \/><a href=\"https:\/\/merikebi.warrenmyers.com\/?p=26049\" class=\"more-link pen_button pen_element_default pen_icon_arrow_double\">Continue reading <span class=\"screen-reader-text\">Answer by warren for How to make a dynamic span for a timechart?<\/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-26049","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\/26049","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=26049"}],"version-history":[{"count":1,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/26049\/revisions"}],"predecessor-version":[{"id":26050,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/26049\/revisions\/26050"}],"wp:attachment":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=26049"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=26049"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=26049"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fkeyring_services&post=26049"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}