<?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: Extractions from query doesn't match events in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/Extractions-from-query-doesn-t-match-events/m-p/123532#M9009</link>
    <description>&lt;P&gt;Just to clarify on this - the script is getting me what I expect and the events actually do show the whole DisplayName value. When I do the query, I &lt;STRONG&gt;don't&lt;/STRONG&gt; get the whole DisplayName value.&lt;/P&gt;</description>
    <pubDate>Wed, 15 Jul 2015 16:23:13 GMT</pubDate>
    <dc:creator>pil321</dc:creator>
    <dc:date>2015-07-15T16:23:13Z</dc:date>
    <item>
      <title>Extractions from query doesn't match events</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Extractions-from-query-doesn-t-match-events/m-p/123529#M9006</link>
      <description>&lt;P&gt;I have this query which is "mostly" working:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=Script:InstalledApps | stats values(host) AS Hosts by DisplayName, DisplayVersion
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I get what I'm expecting from the &lt;CODE&gt;sourcetype=Script:InstalledApps&lt;/CODE&gt; part. The events show the whole DisplayName value for the applications. When I do the entire query, I &lt;STRONG&gt;don't&lt;/STRONG&gt; get the whole DisplayName value. For example, "Security Update for Microsoft .NET Framework 4 Client Profile (KB3037578)" displays as "Security" when I do the &lt;CODE&gt;stats values(host) AS Hosts by DisplayName, DisplayVersion&lt;/CODE&gt; part . Seems like it's a problem mostly with descriptions that have more than one word, but not always (?)&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jul 2015 14:55:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Extractions-from-query-doesn-t-match-events/m-p/123529#M9006</guid>
      <dc:creator>pil321</dc:creator>
      <dc:date>2015-07-15T14:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: Extractions from query doesn't match events</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Extractions-from-query-doesn-t-match-events/m-p/123530#M9007</link>
      <description>&lt;P&gt;Can you post the script up here as it's likely something in the way the script is capturing the application name.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jul 2015 15:30:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Extractions-from-query-doesn-t-match-events/m-p/123530#M9007</guid>
      <dc:creator>jeremiahc4</dc:creator>
      <dc:date>2015-07-15T15:30:08Z</dc:date>
    </item>
    <item>
      <title>Re: Extractions from query doesn't match events</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Extractions-from-query-doesn-t-match-events/m-p/123531#M9008</link>
      <description>&lt;P&gt;Sure - the script is from the Splunk Add-on for Windows app (win_installed_apps.bat):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;@echo off
REM --------------------------------------------------------
REM Copyright (C) 2005-2011 Splunk Inc. All Rights Reserved.
REM --------------------------------------------------------

setlocal EnableDelayedExpansion

REM For each app key, print out the name of the app and any parameters under the entry
for /f "tokens=*" %%G in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" ^| findstr "Uninstall\\"') do (call :output_reg "%%G" 72)

REM Do the same as above but with 32-bit apps, first checking if the key exists
reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" &amp;gt;nul 2&amp;gt;&amp;amp;1
if %ERRORLEVEL% EQU 0 (
  for /f "tokens=*" %%G in ('reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" ^| findstr "Uninstall\\"') do (call :output_reg "%%G" 84)
)

goto :eof

:output_reg

    REM Echo an empty line to indicate that this is a new entry
    @echo.

    REM Get the current date into a variable
    for /f "tokens=*" %%A in ('date /t') do for %%B in (%%A) do set date=%%B

    REM Get the current time into a variable
    set time = 'time /t'
    for /f "tokens=1,2 delims=." %%A in ("%time%") do set time=%%A

    REM Print out the date &amp;amp; time
    @echo %date% %time%

    REM Add the enumerated key
    @echo Installed application enumerated from %1

    REM Get the name of the app from the last segment in the registry path
    set app_name=%1

    REM Strips out the first x characters (from input) of the path in order to get just the app name
    set "app_name=!app_name:~%2%,150!"

    REM Strip the last quote
    set app_name=%app_name:~0,-1% 

    REM Store a count value so that we can avoid printing the first entry
    set count=0

    REM This variable determines if the display name was found
    set display_name_found=0

    REM Now get the sub-keys
    for /F "tokens=1,2*" %%A in ('reg query %1') do (
        set /a count+=1

        REM Skip the entry if it just repeats the name we are querying for or if it is blank or if is "&amp;lt;NO" (which indicates the item has no name)
        if not "%%A" == %1 if not "%%A" == "" if not "%%A" == "&amp;lt;NO" echo %%A=%%C

        REM Note that the display name was already found
        if %%A==DisplayName set /a display_name_found=1
    )

    REM If the display name was not found, then use the name of the registry path name instead
    if !display_name_found!==0 echo DisplayName=%app_name%
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 06:41:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Extractions-from-query-doesn-t-match-events/m-p/123531#M9008</guid>
      <dc:creator>pil321</dc:creator>
      <dc:date>2020-09-29T06:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: Extractions from query doesn't match events</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Extractions-from-query-doesn-t-match-events/m-p/123532#M9009</link>
      <description>&lt;P&gt;Just to clarify on this - the script is getting me what I expect and the events actually do show the whole DisplayName value. When I do the query, I &lt;STRONG&gt;don't&lt;/STRONG&gt; get the whole DisplayName value.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jul 2015 16:23:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Extractions-from-query-doesn-t-match-events/m-p/123532#M9009</guid>
      <dc:creator>pil321</dc:creator>
      <dc:date>2015-07-15T16:23:13Z</dc:date>
    </item>
    <item>
      <title>Re: Extractions from query doesn't match events</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Extractions-from-query-doesn-t-match-events/m-p/123533#M9010</link>
      <description>&lt;P&gt;Ah, ok. So it would appear the stats command is truncating your DisplayName to the first word (field delimiter of a space). I'm not seeing anything on why that would be happening at the moment. Perhaps edit your original question if you can to make that point clearer.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jul 2015 16:49:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Extractions-from-query-doesn-t-match-events/m-p/123533#M9010</guid>
      <dc:creator>jeremiahc4</dc:creator>
      <dc:date>2015-07-15T16:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: Extractions from query doesn't match events</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Extractions-from-query-doesn-t-match-events/m-p/123534#M9011</link>
      <description>&lt;P&gt;Yes - I could have been clearer. I'll edit the question.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jul 2015 17:16:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Extractions-from-query-doesn-t-match-events/m-p/123534#M9011</guid>
      <dc:creator>pil321</dc:creator>
      <dc:date>2015-07-15T17:16:58Z</dc:date>
    </item>
    <item>
      <title>Re: Extractions from query doesn't match events</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Extractions-from-query-doesn-t-match-events/m-p/123535#M9012</link>
      <description>&lt;P&gt;I'm guessing your events have a line like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...
DisplayName=Security Update for Microsoft .NET Framework 4 Client Profile (KB3037578)
...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;While your &lt;CODE&gt;stats&lt;/CODE&gt; - and any other use of the field - only sees &lt;CODE&gt;DisplayName=Security&lt;/CODE&gt;?&lt;/P&gt;

&lt;P&gt;If so, that's due to the way Splunk reads default key-value extractions. There's no quotes surrounding the string, making it hard to automagically recognize that it's more than just a word. To test this, try this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; sourcetype=Script:InstalledApps | rex "DisplayName=(?&amp;lt;myDisplayName&amp;gt;.*)" | stats values(host) AS Hosts by myDisplayName, DisplayVersion
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If that works, move the extraction into Settings -&amp;gt; Fields -&amp;gt; Field Extractions for that sourcetype. Also, make sure to submit feedback to the App's developers to &lt;EM&gt;please, please add quotes&lt;/EM&gt; around the field value to make this unnecessary in the future.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jul 2015 18:57:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Extractions-from-query-doesn-t-match-events/m-p/123535#M9012</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2015-07-15T18:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: Extractions from query doesn't match events</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Extractions-from-query-doesn-t-match-events/m-p/123536#M9013</link>
      <description>&lt;P&gt;That did it....just needed the right SplunkFu! Thanks for the help martin_mueller!&lt;/P&gt;

&lt;P&gt;I'll reach out to the Splunk Add-on for Windows app developers and mention it to them.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2015 15:36:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Extractions-from-query-doesn-t-match-events/m-p/123536#M9013</guid>
      <dc:creator>pil321</dc:creator>
      <dc:date>2015-07-16T15:36:03Z</dc:date>
    </item>
  </channel>
</rss>

