<?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: Eval and Workflows... in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Eval-and-Workflows/m-p/107877#M183406</link>
    <description>&lt;P&gt;You'd need two transforms, but it's definitely doable. &lt;/P&gt;

&lt;P&gt;In &lt;B&gt;transforms.conf&lt;/B&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[cmdbent1]
SOURCE_KEY = host
REGEX = ^(\d+\.\d+\.\d+\.\d+)$
FORMAT = cmdbent::"ip_address"

[cmdbent2]
SOURCE_KEY = host
REGEX = (.)
FORMAT = cmdbent::"name"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In &lt;B&gt;props.conf&lt;/B&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[yoursourcetype]
REPORT-cmdbent = cmdbent1, cmdbent2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;By default, Splunk will not extract a value unless the destination field is empty -- since &lt;CODE&gt;cmdbent1&lt;/CODE&gt; is executed first, &lt;CODE&gt;cmdbent2&lt;/CODE&gt; acts as a fallback/default value.&lt;/P&gt;

&lt;P&gt;If you want the transform to &lt;I&gt;always&lt;/I&gt; apply, then leave out the sourcetype stanza header and place it at the top of props.conf.  If it's not listed beneath a stanza header, it will be treated as a global setting.&lt;/P&gt;</description>
    <pubDate>Thu, 23 Dec 2010 01:21:42 GMT</pubDate>
    <dc:creator>southeringtonp</dc:creator>
    <dc:date>2010-12-23T01:21:42Z</dc:date>
    <item>
      <title>Eval and Workflows...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-and-Workflows/m-p/107876#M183405</link>
      <description>&lt;P&gt;So I've created a couple workflow actions for interfacing with service-now. One of which is looking up the host in our CMDB. Unfortunately, we have a number of devices out there that don't reverse resolve (yeah, I know, we're working on it. :), so sometimes the host field is an IP address. Since the CMDB query in service now doesn't allow you to do "or" in the URL based queries (that I've been able to find), I've got two different workflows, one which executes the query with the argument:&lt;/P&gt;

&lt;P&gt;Name=$host$&lt;/P&gt;

&lt;P&gt;and the other with:&lt;/P&gt;

&lt;P&gt;ip_address=$host$&lt;/P&gt;

&lt;P&gt;I'd like to have a field created at search time, ala the following eval:&lt;/P&gt;

&lt;P&gt;eval cmdbent=if(match(host,"\d+.\d+.\d+.\d+"), "ip_address", "name") . "=" . host&lt;/P&gt;

&lt;P&gt;So really, I'd like to create a field containing "ip_address" if the host value matches the \d+.\d+.\d+.\d regex, but "name" otherwise. Can this be done with a regular transform instead of eval?&lt;/P&gt;

&lt;P&gt;Thanks
Steve&lt;/P&gt;</description>
      <pubDate>Wed, 22 Dec 2010 08:44:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-and-Workflows/m-p/107876#M183405</guid>
      <dc:creator>Steve_Litras</dc:creator>
      <dc:date>2010-12-22T08:44:56Z</dc:date>
    </item>
    <item>
      <title>Re: Eval and Workflows...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-and-Workflows/m-p/107877#M183406</link>
      <description>&lt;P&gt;You'd need two transforms, but it's definitely doable. &lt;/P&gt;

&lt;P&gt;In &lt;B&gt;transforms.conf&lt;/B&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[cmdbent1]
SOURCE_KEY = host
REGEX = ^(\d+\.\d+\.\d+\.\d+)$
FORMAT = cmdbent::"ip_address"

[cmdbent2]
SOURCE_KEY = host
REGEX = (.)
FORMAT = cmdbent::"name"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In &lt;B&gt;props.conf&lt;/B&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[yoursourcetype]
REPORT-cmdbent = cmdbent1, cmdbent2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;By default, Splunk will not extract a value unless the destination field is empty -- since &lt;CODE&gt;cmdbent1&lt;/CODE&gt; is executed first, &lt;CODE&gt;cmdbent2&lt;/CODE&gt; acts as a fallback/default value.&lt;/P&gt;

&lt;P&gt;If you want the transform to &lt;I&gt;always&lt;/I&gt; apply, then leave out the sourcetype stanza header and place it at the top of props.conf.  If it's not listed beneath a stanza header, it will be treated as a global setting.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2010 01:21:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-and-Workflows/m-p/107877#M183406</guid>
      <dc:creator>southeringtonp</dc:creator>
      <dc:date>2010-12-23T01:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: Eval and Workflows...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-and-Workflows/m-p/107878#M183407</link>
      <description>&lt;P&gt;Works perfectly! Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 24 Dec 2010 01:11:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-and-Workflows/m-p/107878#M183407</guid>
      <dc:creator>Steve_Litras</dc:creator>
      <dc:date>2010-12-24T01:11:04Z</dc:date>
    </item>
  </channel>
</rss>

