<?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: How do we edit the format of a token value before it is passed to a search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-we-edit-the-format-of-a-token-value-before-it-is-passed/m-p/200680#M58187</link>
    <description>&lt;P&gt;I saw someone used noop in the same way so though of suggesting with it. It's indeed not documented but some details available here.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/241584/splunk-should-upgrade-the-noop-command-to-take-a-s.html"&gt;https://answers.splunk.com/answers/241584/splunk-should-upgrade-the-noop-command-to-take-a-s.html&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Oct 2015 20:32:21 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2015-10-27T20:32:21Z</dc:date>
    <item>
      <title>How do we edit the format of a token value before it is passed to a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-we-edit-the-format-of-a-token-value-before-it-is-passed/m-p/200676#M58183</link>
      <description>&lt;P&gt;Experts,&lt;/P&gt;

&lt;P&gt;We have a input form which expects a UID type of data from users. There are few known formats to UID, like: &lt;CODE&gt;abcd:efgh:ijkl&lt;/CODE&gt;  OR &lt;CODE&gt;ab-cd-ef-gh-ij-kl&lt;/CODE&gt; OR &lt;CODE&gt;ab:cd:ef:gh:ij:kl&lt;/CODE&gt; OR &lt;CODE&gt;ab.cd.ef.gh.ij.kl&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;User can enter any one of these formats which we grab to the token "fix". We then want to straighten the user input by removing &lt;CODE&gt;-&lt;/CODE&gt;,&lt;CODE&gt;:&lt;/CODE&gt;,&lt;CODE&gt;.&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Example: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=abc source=xyz fix=search[|eval fix="$fix$"|eval fix1 = upper(replace(fix,"([-:\.])",""))|return fix1]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is not working. It keeps saying that it didn't find any results. If I just use: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=abc source=xyz |eval fix = upper(replace(Original_field,"([-:\.])"),"") 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;it straightens out and gives the desired output: &lt;CODE&gt;ABDCDEFGHIJKL&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Note: &lt;STRONG&gt;Original_field&lt;/STRONG&gt; is what actually holds the &lt;CODE&gt;abcd:efgh:ijkl&lt;/CODE&gt;  OR &lt;CODE&gt;ab-cd-ef-gh-ij-kl&lt;/CODE&gt; OR &lt;CODE&gt;ab:cd:ef:gh:ij:kl&lt;/CODE&gt; OR &lt;CODE&gt;ab.cd.ef.gh.ij.kl&lt;/CODE&gt; patterns. We have created "Fix" as a Field Extraction to straighten out data from the Backend. Since we can't anticipate what format the user is going to enter, we want to grab it anyway and straighten it out and pass it to the search from the front-end as well. I have been searching and found couple of answers &lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/127021/manipulate-a-token-string-in-a-form.html"&gt;https://answers.splunk.com/answers/127021/manipulate-a-token-string-in-a-form.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;
but no luck.&lt;/P&gt;

&lt;P&gt;Thanks in advance&lt;BR /&gt;
Avanthi&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2015 04:10:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-we-edit-the-format-of-a-token-value-before-it-is-passed/m-p/200676#M58183</guid>
      <dc:creator>avanthi1823</dc:creator>
      <dc:date>2015-10-27T04:10:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do we edit the format of a token value before it is passed to a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-we-edit-the-format-of-a-token-value-before-it-is-passed/m-p/200677#M58184</link>
      <description>&lt;P&gt;Would making the value of &lt;CODE&gt;fix=$fix$&lt;/CODE&gt; a subsearch accomplish what you need?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=abc source=xyz [search | stats count |eval fix="$fix$"|eval fix = upper(replace(fix,"([-:\.])",""))| fields - count]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Oct 2015 19:09:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-we-edit-the-format-of-a-token-value-before-it-is-passed/m-p/200677#M58184</guid>
      <dc:creator>wpreston</dc:creator>
      <dc:date>2015-10-27T19:09:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do we edit the format of a token value before it is passed to a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-we-edit-the-format-of-a-token-value-before-it-is-passed/m-p/200678#M58185</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=abc source=xyz fix=search[| noop |eval fix="$fix$"|eval fix1 = upper(replace(fix,"([-:\.])",""))|return fix1]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Update&lt;/STRONG&gt; Didn't test that | noop doesn't work for this purpose.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=abc source=xyz fix=search[| gentimes start=-1 |eval fix="$fix$"|eval fix1 = upper(replace(fix,"([-:\.])",""))|return fix1]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Oct 2015 19:20:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-we-edit-the-format-of-a-token-value-before-it-is-passed/m-p/200678#M58185</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-10-27T19:20:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do we edit the format of a token value before it is passed to a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-we-edit-the-format-of-a-token-value-before-it-is-passed/m-p/200679#M58186</link>
      <description>&lt;P&gt;It looks like &lt;CODE&gt;noop&lt;/CODE&gt; is an undocumented command.  Would you mind giving a quick rundown of what it does?  I'd like to learn...&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2015 19:24:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-we-edit-the-format-of-a-token-value-before-it-is-passed/m-p/200679#M58186</guid>
      <dc:creator>wpreston</dc:creator>
      <dc:date>2015-10-27T19:24:40Z</dc:date>
    </item>
    <item>
      <title>Re: How do we edit the format of a token value before it is passed to a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-we-edit-the-format-of-a-token-value-before-it-is-passed/m-p/200680#M58187</link>
      <description>&lt;P&gt;I saw someone used noop in the same way so though of suggesting with it. It's indeed not documented but some details available here.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/241584/splunk-should-upgrade-the-noop-command-to-take-a-s.html"&gt;https://answers.splunk.com/answers/241584/splunk-should-upgrade-the-noop-command-to-take-a-s.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2015 20:32:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-we-edit-the-format-of-a-token-value-before-it-is-passed/m-p/200680#M58187</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-10-27T20:32:21Z</dc:date>
    </item>
  </channel>
</rss>

