<?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: Combining static single-word from lookup table with sentence in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Combining-static-single-word-from-lookup-table-with-sentence/m-p/688083#M234632</link>
    <description>&lt;P&gt;You can make volunteers' life easier by listing sample lookup content in table format, and construct mock/sample SQL values according to illustrated lookup table or vice versa.&lt;/P&gt;&lt;P&gt;Anyway, there are often different ways to solve the same problem depending on actual data characteristics and nuances in requirements. &amp;nbsp;If I understand you correctly, you want to catalogue events into some&amp;nbsp;&lt;EM&gt;lk_wlc_app_name&lt;/EM&gt;&amp;nbsp;based on &lt;STRONG&gt;fragments&lt;/STRONG&gt; of SQL that may match &lt;EM&gt;lk_wlc_app_short&lt;/EM&gt;. &amp;nbsp;You mentioned that SQL has no structure (regarding the key strings you are trying to match); your illustrated data suggest that your intended matches do not fall in "natural" word boundaries. &amp;nbsp;This makes any strategy at risk of being too aggressive as to give false positives.&lt;/P&gt;&lt;P&gt;Because of the constraints, one very aggressive strategy is to use wildcard matches. &amp;nbsp;You need to set "&lt;SPAN&gt;Match type" of &lt;EM&gt;lk_wlc_app_short&lt;/EM&gt;&amp;nbsp;to WILDCARD&lt;/SPAN&gt; in "Advanced Options", and your table should contain wildcards before and after the short string, like&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%"&gt;&lt;SPAN&gt;lk_wlc_app_short&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="50%"&gt;&lt;SPAN&gt;lk_wlc_app_name&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;&lt;SPAN&gt;*ART*&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="50%"&gt;&lt;SPAN&gt;Attendance Roster Tool&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;&lt;SPAN&gt;*Building_Mailer*&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="50%"&gt;&lt;SPAN&gt;Building Mailer&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;&lt;SPAN&gt;*SCBT*&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="50%"&gt;&amp;nbsp;&lt;SPAN&gt;Service Center Billing Tool&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Once this is set up, all you need is lookup, like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| lookup lookup_weblogic_app lk_wlc_app_short as SQL&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Again, this is perhaps not an optimal solution because look-backward match is expensive.&lt;/P&gt;</description>
    <pubDate>Mon, 20 May 2024 20:49:34 GMT</pubDate>
    <dc:creator>yuanliu</dc:creator>
    <dc:date>2024-05-20T20:49:34Z</dc:date>
    <item>
      <title>Combining static single-word from lookup table with sentence</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-static-single-word-from-lookup-table-with-sentence/m-p/687055#M234331</link>
      <description>&lt;P&gt;hello I need to determine the app name based on a lookup table for the SPL search below.&lt;BR /&gt;the SPL search results has a field, called SQL, which has the sql syntax which contains one of the keywords in a field of the lookup table.&lt;/P&gt;&lt;P&gt;I am not sure if join, union, inputlookup, lookup and/or combination of where command will solve this puzzle.&lt;BR /&gt;Any help is apreciated.&lt;/P&gt;&lt;P&gt;the lookup file name is:&lt;BR /&gt;lookup_weblogic_app.csv&lt;BR /&gt;the lookup file sample values are:&lt;BR /&gt;lk_wlc_app_short lk_wlc_app_name&lt;BR /&gt;ART Attendance Roster Tool&lt;BR /&gt;Building_Mailer Building Mailer&lt;BR /&gt;SCBT Service Center Billing Tool&lt;/P&gt;&lt;P&gt;SPL search results:&lt;BR /&gt;SQL&lt;BR /&gt;''' as "FIELD",''Missing Value'' AS "ERROR" from scbt_owner.SCBT_LOAD_CLOB_DATA_WORK&lt;BR /&gt;''' as "something ",''Missing Value'' AS "ERROR" from ART_owner.ART_LOAD_CLOB_DATA_WORK&lt;BR /&gt;from Building_Mailer_owner.Building_Mailer_&lt;/P&gt;&lt;P&gt;SPL final outcome desire:&lt;BR /&gt;lk_wlc_app_short SQL&lt;BR /&gt;scbt ''' as "FIELD",''Missing Value'' AS "ERROR" from scbt_owner.SCBT_LOAD_CLOB_DATA_WORK&lt;BR /&gt;ATR ''' as "something ",''Missing Value'' AS "ERROR" from ART_owner.ART_LOAD_CLOB_DATA_WORK&lt;BR /&gt;Building_Mailer from Building_Mailer_owner.Building_Mailer_&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 15:28:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-static-single-word-from-lookup-table-with-sentence/m-p/687055#M234331</guid>
      <dc:creator>alfredoh14</dc:creator>
      <dc:date>2024-05-09T15:28:45Z</dc:date>
    </item>
    <item>
      <title>Re: Combining static single-word from lookup table with sentence</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-static-single-word-from-lookup-table-with-sentence/m-p/687109#M234353</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/230438"&gt;@alfredoh14&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's some SPL that gives you a table with the app name, short name, and SQL:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults count=3
| streamstats count as id
| eval sql=case(id=1,"'' as \"FIELD\",''Missing Value'' AS \"ERROR\" from scbt_owner.SCBT_LOAD_CLOB_DATA_WORK",
id=2,"'' as \"something \",''Missing Value'' AS \"ERROR\" from ART_owner.ART_LOAD_CLOB_DATA_WORK",
id=3, "from Building_Mailer_owner.Building_Mailer_")
| fields sql
``` The above was just to create the source data ```
| rex field="sql" "from\s+(?&amp;lt;lk_wlc_app_short&amp;gt;.+?)_owner"
| lookup lookup_weblogic_app lk_wlc_app_short
| table lk_wlc_app_short, lk_wlc_app_name, sql&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The regular expression pulls out the table name in the SQL, eg "from XXXX_owner", and uses the short code to match the app name from the lookup.&lt;BR /&gt;&lt;BR /&gt;To make the lookup work, you will need to ensure that the matches are NOT case sensitive, or make sure your lookup fields match what is in the SQL.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="danspav_0-1715296318468.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/30761i1F3A47C5EA4D04D2/image-size/large?v=v2&amp;amp;px=999" role="button" title="danspav_0-1715296318468.png" alt="danspav_0-1715296318468.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 23:13:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-static-single-word-from-lookup-table-with-sentence/m-p/687109#M234353</guid>
      <dc:creator>danspav</dc:creator>
      <dc:date>2024-05-09T23:13:26Z</dc:date>
    </item>
    <item>
      <title>Re: Combining static single-word from lookup table with sentence</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-static-single-word-from-lookup-table-with-sentence/m-p/687671#M234536</link>
      <description>&lt;P&gt;Thank you that is something that i will use if I cannot find anything that would actually do what i need.&lt;BR /&gt;the issue is that the lookup file column is one word while the sql field would be many characters.&lt;BR /&gt;the example I gave provided a structure wherein you could use rex however, in my real life data, there is no structure, for example, :&lt;/P&gt;&lt;P&gt;scbt_owner could be found as "scbt" or "scbt_owner" or " as scbt" or "where scbt"&lt;/P&gt;&lt;P&gt;if it were those 4 examples i gave, then yes i would be able to use rex but they might be different text in the SQL column.&lt;/P&gt;&lt;P&gt;basically, the issue is that i would like to use the lookup file lk_wlc_app_short , to do a "in" the sql field.&lt;BR /&gt;so i would use the lookup file as a base, and if any of the text in the lookup file match the sql field, i would flag them as a match and I would be able to get the final table output I want.&lt;/P&gt;&lt;P&gt;I am not sure if splunk can do this, I know it can do a match if both the sql field and the lk_wlc_app_short field are the same (as you gave me in your example), but can Splunk be able to determine which rows of the lookup file match the SQL field without having to parse with rex since i know the sql field text would be random?&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2024 02:18:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-static-single-word-from-lookup-table-with-sentence/m-p/687671#M234536</guid>
      <dc:creator>alfredoh14</dc:creator>
      <dc:date>2024-05-16T02:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: Combining static single-word from lookup table with sentence</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-static-single-word-from-lookup-table-with-sentence/m-p/688083#M234632</link>
      <description>&lt;P&gt;You can make volunteers' life easier by listing sample lookup content in table format, and construct mock/sample SQL values according to illustrated lookup table or vice versa.&lt;/P&gt;&lt;P&gt;Anyway, there are often different ways to solve the same problem depending on actual data characteristics and nuances in requirements. &amp;nbsp;If I understand you correctly, you want to catalogue events into some&amp;nbsp;&lt;EM&gt;lk_wlc_app_name&lt;/EM&gt;&amp;nbsp;based on &lt;STRONG&gt;fragments&lt;/STRONG&gt; of SQL that may match &lt;EM&gt;lk_wlc_app_short&lt;/EM&gt;. &amp;nbsp;You mentioned that SQL has no structure (regarding the key strings you are trying to match); your illustrated data suggest that your intended matches do not fall in "natural" word boundaries. &amp;nbsp;This makes any strategy at risk of being too aggressive as to give false positives.&lt;/P&gt;&lt;P&gt;Because of the constraints, one very aggressive strategy is to use wildcard matches. &amp;nbsp;You need to set "&lt;SPAN&gt;Match type" of &lt;EM&gt;lk_wlc_app_short&lt;/EM&gt;&amp;nbsp;to WILDCARD&lt;/SPAN&gt; in "Advanced Options", and your table should contain wildcards before and after the short string, like&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%"&gt;&lt;SPAN&gt;lk_wlc_app_short&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="50%"&gt;&lt;SPAN&gt;lk_wlc_app_name&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;&lt;SPAN&gt;*ART*&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="50%"&gt;&lt;SPAN&gt;Attendance Roster Tool&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;&lt;SPAN&gt;*Building_Mailer*&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="50%"&gt;&lt;SPAN&gt;Building Mailer&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;&lt;SPAN&gt;*SCBT*&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="50%"&gt;&amp;nbsp;&lt;SPAN&gt;Service Center Billing Tool&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Once this is set up, all you need is lookup, like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| lookup lookup_weblogic_app lk_wlc_app_short as SQL&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Again, this is perhaps not an optimal solution because look-backward match is expensive.&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2024 20:49:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-static-single-word-from-lookup-table-with-sentence/m-p/688083#M234632</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-05-20T20:49:34Z</dc:date>
    </item>
  </channel>
</rss>

