<?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: Using Data as Fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Using-Data-as-Fields/m-p/307018#M163616</link>
    <description>&lt;P&gt;hey @leonheart78&lt;/P&gt;

&lt;P&gt;I think the better way is to do with lookups.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;step 1&lt;/STRONG&gt; : Create a lookup table say &lt;CODE&gt;mylookup.csv&lt;/CODE&gt; with columns &lt;CODE&gt;Tag&lt;/CODE&gt;  and &lt;CODE&gt;Description&lt;/CODE&gt;&lt;BR /&gt;
Tag | Description&lt;BR /&gt;
R0001 | Batch No&lt;BR /&gt;
R0002 | Year&lt;BR /&gt;
R0003 | Month&lt;BR /&gt;
R0004 | Day&lt;BR /&gt;
R0005 | Volume A &lt;BR /&gt;
R0006 | Volume B&lt;BR /&gt;
R0007 | Volume C&lt;BR /&gt;
R0008 | Total Mixed&lt;BR /&gt;
R0009 | Result (0 = OK, 1 = Not OK)&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Step 2&lt;/STRONG&gt; : After creating a lookup table, add the lookup table into Splunk.&lt;BR /&gt;
Follow this doc to add &lt;CODE&gt;mylookup.csv&lt;/CODE&gt; &lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.0.1/PivotTutorial/AddlookupfilestoSplunk"&gt;https://docs.splunk.com/Documentation/Splunk/7.0.1/PivotTutorial/AddlookupfilestoSplunk&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Step 3&lt;/STRONG&gt; : then write this query on the search head&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| lookup mylookup.csv Tag OUTPUT Description | stats count by Tag Value | eval Description=case(Value=0 AND Description="Result","OK",Value=1 AND Description="Result","NOT OK",1=1,Description)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I hope this helps you!&lt;/P&gt;</description>
    <pubDate>Tue, 16 Jan 2018 07:11:24 GMT</pubDate>
    <dc:creator>mayurr98</dc:creator>
    <dc:date>2018-01-16T07:11:24Z</dc:date>
    <item>
      <title>Using Data as Fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Data-as-Fields/m-p/307014#M163612</link>
      <description>&lt;P&gt;I’m currently working with some production line data, where each tag value represent a field. Example like below:&lt;/P&gt;

&lt;P&gt;Tag     |   Value&lt;BR /&gt;
R0001   |   1           -&amp;gt; Batch No&lt;BR /&gt;
R0002   |   2018        -&amp;gt; Year&lt;BR /&gt;
R0003   |   1           -&amp;gt; Month&lt;BR /&gt;
R0004   |   22          -&amp;gt; Day&lt;BR /&gt;
R0005   |   5040        -&amp;gt; Volume A &lt;BR /&gt;
R0006   |   446         -&amp;gt; Volume B&lt;BR /&gt;
R0007   |   189         -&amp;gt; Volume C&lt;BR /&gt;
R0008   |   1099        -&amp;gt; Total Mixed&lt;BR /&gt;
R0009   |   0           -&amp;gt; Result (0 = OK, 1 = Not OK)&lt;/P&gt;

&lt;P&gt;I need to arrange the data to look as below&lt;BR /&gt;
Batch No    |Year   |Month  |Day      |Volume A |Volume B   |Volume C   |Total Mixed      |Result&lt;BR /&gt;
1                   |2018   |1          |22        |5040            |446            |189            |1099                |OK&lt;BR /&gt;
2                   |2018   |1          |23        |5030            |435            |198            |1078                |OK&lt;/P&gt;

&lt;P&gt;I was looking at using the Lookup table  to achieve it, but not sure how to go about doing it. Any advise is appreciated. Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 01:25:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Data-as-Fields/m-p/307014#M163612</guid>
      <dc:creator>leonheart78</dc:creator>
      <dc:date>2018-01-16T01:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: Using Data as Fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Data-as-Fields/m-p/307015#M163613</link>
      <description>&lt;P&gt;Could you present a sample of _raw data?&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 02:13:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Data-as-Fields/m-p/307015#M163613</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2018-01-16T02:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: Using Data as Fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Data-as-Fields/m-p/307016#M163614</link>
      <description>&lt;P&gt;You'll probably have better results using Field Aliases.   A the name implies, field aliases let you define alternative names for some fields.  You could, for example, create alias "Batch" for field "R0001", and so on.  See &lt;A href="http://docs.splunk.com/Documentation/Splunk/7.0.1/Knowledge/Addaliasestofields"&gt;http://docs.splunk.com/Documentation/Splunk/7.0.1/Knowledge/Addaliasestofields&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 02:19:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Data-as-Fields/m-p/307016#M163614</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2018-01-16T02:19:16Z</dc:date>
    </item>
    <item>
      <title>Re: Using Data as Fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Data-as-Fields/m-p/307017#M163615</link>
      <description>&lt;P&gt;An example&lt;BR /&gt;
Separate key / value pairs If the delimited character is a comma&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|NOOP|stats count as _raw|eval _raw="R0001|1
,R0002|2018
,R0003|1R0004|22
,R0005|5040
,R0006|446
,R0007|189
,R0008|1099
,R0009|0"
| extract pairdelim=",", kvdelim="|"
|rename R0001 as "Batch No"
|rename R0002 as "Year"
|rename R0003 as "Month"
|rename R0004 as "Day"
|rename R0005 as "Volume A"
|rename R0006 as "Volume B"
|rename R0007 as "Volume C"
|rename R0008 as "Total Mixed"
|rename R0009 as "Result"
|eval Result=if(Result=0,"OK","Not OK")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Jan 2018 02:35:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Data-as-Fields/m-p/307017#M163615</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2018-01-16T02:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: Using Data as Fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Data-as-Fields/m-p/307018#M163616</link>
      <description>&lt;P&gt;hey @leonheart78&lt;/P&gt;

&lt;P&gt;I think the better way is to do with lookups.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;step 1&lt;/STRONG&gt; : Create a lookup table say &lt;CODE&gt;mylookup.csv&lt;/CODE&gt; with columns &lt;CODE&gt;Tag&lt;/CODE&gt;  and &lt;CODE&gt;Description&lt;/CODE&gt;&lt;BR /&gt;
Tag | Description&lt;BR /&gt;
R0001 | Batch No&lt;BR /&gt;
R0002 | Year&lt;BR /&gt;
R0003 | Month&lt;BR /&gt;
R0004 | Day&lt;BR /&gt;
R0005 | Volume A &lt;BR /&gt;
R0006 | Volume B&lt;BR /&gt;
R0007 | Volume C&lt;BR /&gt;
R0008 | Total Mixed&lt;BR /&gt;
R0009 | Result (0 = OK, 1 = Not OK)&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Step 2&lt;/STRONG&gt; : After creating a lookup table, add the lookup table into Splunk.&lt;BR /&gt;
Follow this doc to add &lt;CODE&gt;mylookup.csv&lt;/CODE&gt; &lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.0.1/PivotTutorial/AddlookupfilestoSplunk"&gt;https://docs.splunk.com/Documentation/Splunk/7.0.1/PivotTutorial/AddlookupfilestoSplunk&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Step 3&lt;/STRONG&gt; : then write this query on the search head&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| lookup mylookup.csv Tag OUTPUT Description | stats count by Tag Value | eval Description=case(Value=0 AND Description="Result","OK",Value=1 AND Description="Result","NOT OK",1=1,Description)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I hope this helps you!&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 07:11:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Data-as-Fields/m-p/307018#M163616</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-16T07:11:24Z</dc:date>
    </item>
  </channel>
</rss>

