<?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: Use other events fields as a field for your search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Use-other-events-fields-as-a-field-for-your-search/m-p/311386#M165520</link>
    <description>&lt;P&gt;It doesn't seem to be working...&lt;BR /&gt;
Take into account that from my expected results below, what I'm painting bold comes from rows 3 &amp;amp; 4 and what is italic comes from matching the IDCategory with rows 0 &amp;amp; 1 and adding the name as a new column.&lt;/P&gt;

&lt;P&gt;ID . | Name . |Type . | IDCategory&lt;BR /&gt;
0|Category1|Category|null&lt;BR /&gt;
1|Categoryt2|Category|null&lt;BR /&gt;
3|Item1|Item|0&lt;BR /&gt;
4|Item2|Item|1&lt;/P&gt;

&lt;P&gt;What I need is to output the following for items 2 and 4:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;3|Item1|Item|0&lt;/STRONG&gt;|&lt;EM&gt;Category1&lt;/EM&gt;&lt;BR /&gt;
&lt;STRONG&gt;4|Item2|Item|1&lt;/STRONG&gt;|&lt;EM&gt;Category2&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;Thank you!&lt;/P&gt;</description>
    <pubDate>Thu, 19 Oct 2017 18:34:20 GMT</pubDate>
    <dc:creator>pmgahan</dc:creator>
    <dc:date>2017-10-19T18:34:20Z</dc:date>
    <item>
      <title>Use other events fields as a field for your search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-other-events-fields-as-a-field-for-your-search/m-p/311383#M165517</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I need to use events on a data source as a reference for other events&lt;/P&gt;

&lt;P&gt;Example:&lt;/P&gt;

&lt;P&gt;ID .  | Name .  |Type .   | IDCategory&lt;BR /&gt;
0|Category1|Category|null&lt;BR /&gt;
1|Categoryt2|Category|null&lt;BR /&gt;
3|Item1|Item|0&lt;BR /&gt;
4|Item2|Item|1&lt;/P&gt;

&lt;P&gt;What I need is to output the following for items 2 and 4:&lt;/P&gt;

&lt;P&gt;3|Item1|Item|0|Category1&lt;BR /&gt;
4|Item2|Item|1|Category2&lt;/P&gt;

&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 13:14:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-other-events-fields-as-a-field-for-your-search/m-p/311383#M165517</guid>
      <dc:creator>pmgahan</dc:creator>
      <dc:date>2017-10-19T13:14:20Z</dc:date>
    </item>
    <item>
      <title>Re: Use other events fields as a field for your search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-other-events-fields-as-a-field-for-your-search/m-p/311384#M165518</link>
      <description>&lt;P&gt;Hi pmgahan,&lt;BR /&gt;
try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=your_index
| rename IDCategory AS ID_Key
| join ID_Key [ search index=your_index | rename IDCategory AS ID_Key Name AS Category_Name| fields ID_Key  Category_Name]
| table ID Name Type ID_Key Category_Name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Put attention that the search is the same in both main and sub search.&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 14:34:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-other-events-fields-as-a-field-for-your-search/m-p/311384#M165518</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-10-19T14:34:31Z</dc:date>
    </item>
    <item>
      <title>Re: Use other events fields as a field for your search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-other-events-fields-as-a-field-for-your-search/m-p/311385#M165519</link>
      <description>&lt;P&gt;Try this!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(your search)
|eval Name=if(Type="Category","",Name)
|eval Category=if(Type="Category",Name,"")
|eval IDCategory=if(Type="Category",ID,IDCategory)
|eval ID=if(Type="Category","",ID)
|eval Type=if(Type="Category","",Type)
|stats earliest(ID) as ID,
            earliest(Name) as Name,
            earliest(Type) as Type,
            earliest(Category) as Category by IDCategory
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Oct 2017 14:41:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-other-events-fields-as-a-field-for-your-search/m-p/311385#M165519</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2017-10-19T14:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: Use other events fields as a field for your search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-other-events-fields-as-a-field-for-your-search/m-p/311386#M165520</link>
      <description>&lt;P&gt;It doesn't seem to be working...&lt;BR /&gt;
Take into account that from my expected results below, what I'm painting bold comes from rows 3 &amp;amp; 4 and what is italic comes from matching the IDCategory with rows 0 &amp;amp; 1 and adding the name as a new column.&lt;/P&gt;

&lt;P&gt;ID . | Name . |Type . | IDCategory&lt;BR /&gt;
0|Category1|Category|null&lt;BR /&gt;
1|Categoryt2|Category|null&lt;BR /&gt;
3|Item1|Item|0&lt;BR /&gt;
4|Item2|Item|1&lt;/P&gt;

&lt;P&gt;What I need is to output the following for items 2 and 4:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;3|Item1|Item|0&lt;/STRONG&gt;|&lt;EM&gt;Category1&lt;/EM&gt;&lt;BR /&gt;
&lt;STRONG&gt;4|Item2|Item|1&lt;/STRONG&gt;|&lt;EM&gt;Category2&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 18:34:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-other-events-fields-as-a-field-for-your-search/m-p/311386#M165520</guid>
      <dc:creator>pmgahan</dc:creator>
      <dc:date>2017-10-19T18:34:20Z</dc:date>
    </item>
    <item>
      <title>Re: Use other events fields as a field for your search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-other-events-fields-as-a-field-for-your-search/m-p/311387#M165521</link>
      <description>&lt;P&gt;This is adding a column and moving the Name to this new column but what I need is to add the Category name to the row where the categoryID matches the Category's row ID&lt;/P&gt;

&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 18:52:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-other-events-fields-as-a-field-for-your-search/m-p/311387#M165521</guid>
      <dc:creator>pmgahan</dc:creator>
      <dc:date>2017-10-19T18:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: Use other events fields as a field for your search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-other-events-fields-as-a-field-for-your-search/m-p/311388#M165522</link>
      <description>&lt;P&gt;I figured that what I may have to do is the following&lt;/P&gt;

&lt;P&gt;index=your_index&lt;BR /&gt;
 | rename IDCategory AS ID_Key&lt;BR /&gt;
 | join ID_Key [ search index=your_index | rename ID AS ID_Key Name AS Category_Name| fields ID_Key  Category_Name]&lt;BR /&gt;
 | table ID Name Type ID_Key Category_Name&lt;/P&gt;

&lt;P&gt;This should match the IDCategory of one row to the ID for the category and output the Name. It is still not working.&lt;/P&gt;

&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:17:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-other-events-fields-as-a-field-for-your-search/m-p/311388#M165522</guid>
      <dc:creator>pmgahan</dc:creator>
      <dc:date>2020-09-29T16:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: Use other events fields as a field for your search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-other-events-fields-as-a-field-for-your-search/m-p/311389#M165523</link>
      <description>&lt;P&gt;The Joins command links events with common fields, but it is a very heavy search command.&lt;BR /&gt;
Please link as much as possible with stats or transaction command.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Oct 2017 00:53:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-other-events-fields-as-a-field-for-your-search/m-p/311389#M165523</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2017-10-20T00:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: Use other events fields as a field for your search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-other-events-fields-as-a-field-for-your-search/m-p/311390#M165524</link>
      <description>&lt;P&gt;Hi pmgahan,&lt;BR /&gt;
in other words, you want only the rows where there's the match between IDCategory and ID, is it correct?&lt;BR /&gt;
if I correctly understood, try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=your_index
| rename IDCategory AS ID_Key
| join ID_Key [ search index=your_index | rename IDCategory AS ID_Key Name AS Category_Name| fields ID_Key  Category_Name]
| search Category_Name=*
| table ID Name Type ID_Key Category_Name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In this way you'll have only&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;3|Item1|Item|0|Category1
4|Item2|Item|1|Category2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 20 Oct 2017 12:05:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-other-events-fields-as-a-field-for-your-search/m-p/311390#M165524</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-10-20T12:05:52Z</dc:date>
    </item>
    <item>
      <title>Re: Use other events fields as a field for your search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-other-events-fields-as-a-field-for-your-search/m-p/311391#M165525</link>
      <description>&lt;P&gt;Thanks Giuseppe, but the result from your search would result as follows:&lt;/P&gt;

&lt;P&gt;3|Item1|Item|0|Item1&lt;BR /&gt;
 4|Item2|Item|1|Item1&lt;/P&gt;

&lt;P&gt;instead of&lt;/P&gt;

&lt;P&gt;3|Item1|Item|0|Category1&lt;BR /&gt;
4|Item2|Item|1|Category2&lt;/P&gt;

&lt;P&gt;Patrick&lt;/P&gt;</description>
      <pubDate>Fri, 20 Oct 2017 13:07:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-other-events-fields-as-a-field-for-your-search/m-p/311391#M165525</guid>
      <dc:creator>pmgahan</dc:creator>
      <dc:date>2017-10-20T13:07:59Z</dc:date>
    </item>
    <item>
      <title>Re: Use other events fields as a field for your search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-other-events-fields-as-a-field-for-your-search/m-p/311392#M165526</link>
      <description>&lt;P&gt;Hi pmgahan,&lt;BR /&gt;
sorry I did an error in subsearch, try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=your_index 
| rename IDCategory AS ID_Key
| join ID_Key [ search index=your_index | rename ID AS ID_Key Name AS Category_Name | fields ID_Key  Category_Name ]
| search Category_Name=*
| table ID Name Type ID_Key Category_Name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;it should run&lt;BR /&gt;
after try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=your_index IDCategory=*
| rename IDCategory AS ID_Key
| join ID_Key [ search index=your_index NOT IDCategory=* | rename ID AS ID_Key Name AS Category_Name| fields ID_Key  Category_Name]
| table ID Name Type ID_Key Category_Name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;that should be quicker.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 20 Oct 2017 13:31:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-other-events-fields-as-a-field-for-your-search/m-p/311392#M165526</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-10-20T13:31:07Z</dc:date>
    </item>
  </channel>
</rss>

