<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Reuse-able Pattern matching blocks for eval? in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/Reuse-able-Pattern-matching-blocks-for-eval/m-p/607422#M13475</link>
    <description>&lt;P&gt;have you got any good links?&amp;nbsp; else I'll just search&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 28 Jul 2022 20:21:20 GMT</pubDate>
    <dc:creator>splunkernator</dc:creator>
    <dc:date>2022-07-28T20:21:20Z</dc:date>
    <item>
      <title>Reuse-able Pattern matching blocks for eval?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Reuse-able-Pattern-matching-blocks-for-eval/m-p/605082#M13245</link>
      <description>&lt;P&gt;Code is easier to explain: I wanted a bunch of new categories and i found eval especially useful - here is an obfuscated example&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| index=my_index CONNECTED source="/var/log/vmware/my_log.log" 
| eval vdi_pool=case(
    match(name,"1A-VDI\d{3}"), "pool1",
    match(name,"1B-VDI\d{3}"), "pool2",
    match(name,"2A-VDI\d{3}"), "pool3",
    match(name,"2B-VDI\d{3}"), "pool4",
    match(name,"3A-VDI\d{3}"), "pool5",
    match(name,"3B-VDI\d{3}"), "pool6",
    1=1, "unclassified"
)
| timechart span=1h count by vdi_pool&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;This made the subsequent querys super easy.&amp;nbsp; &amp;nbsp;Irritatingly within the dashboard, if I add a new value I need to update all of the queries - this vexes me greatly&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":sad_but_relieved_face:"&gt;😥&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have noticed the entire definition can be downloaded as a json doc - so Im tempted to start templating this in python - this does not seem sane - ideally I'd like to create blocks of repeatable logic I can assemble together to show different scenarios.&lt;/P&gt;&lt;P&gt;Anyone done anything similar to achieve this kind of capability - but more "splunkonic"?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jul 2022 19:09:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Reuse-able-Pattern-matching-blocks-for-eval/m-p/605082#M13245</guid>
      <dc:creator>splunkernator</dc:creator>
      <dc:date>2022-07-10T19:09:56Z</dc:date>
    </item>
    <item>
      <title>Re: Reuse-able Pattern matching blocks for eval?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Reuse-able-Pattern-matching-blocks-for-eval/m-p/605088#M13247</link>
      <description>&lt;P&gt;If this is reusable code, then it should be a macro - then if it changes, just change the macro definition and all uses of the macro will use the new definition.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2022 00:04:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Reuse-able-Pattern-matching-blocks-for-eval/m-p/605088#M13247</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2022-07-11T00:04:18Z</dc:date>
    </item>
    <item>
      <title>Re: Reuse-able Pattern matching blocks for eval?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Reuse-able-Pattern-matching-blocks-for-eval/m-p/607422#M13475</link>
      <description>&lt;P&gt;have you got any good links?&amp;nbsp; else I'll just search&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2022 20:21:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Reuse-able-Pattern-matching-blocks-for-eval/m-p/607422#M13475</guid>
      <dc:creator>splunkernator</dc:creator>
      <dc:date>2022-07-28T20:21:20Z</dc:date>
    </item>
    <item>
      <title>Re: Reuse-able Pattern matching blocks for eval?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Reuse-able-Pattern-matching-blocks-for-eval/m-p/607684#M13497</link>
      <description>&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.7/Knowledge/Definesearchmacros" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.2.7/Knowledge/Definesearchmacros&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.6/Knowledge/Usesearchmacros" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.2.6/Knowledge/Usesearchmacros&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 31 Jul 2022 22:08:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Reuse-able-Pattern-matching-blocks-for-eval/m-p/607684#M13497</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2022-07-31T22:08:40Z</dc:date>
    </item>
  </channel>
</rss>

