<?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 Extracting data from specific field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-specific-field/m-p/114556#M30298</link>
    <description>&lt;P&gt;hi i tried playing with rex and regex but couldn't figure exact expression. my command field is in 3 different scenarios&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;1) COMMAND=/usr/local/bin/ssh -q host1
2) COMMAND=/usr/local/bin/ssh host1
3) COMMAND=/usr/local/bin/ssh -q host1 df -h
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;i want a search to give my results only in (1) and (2). we have jump server where many users jump via sudo to other users and i want the list of users only who jumped and not who executed command via for loop in scenario (3).&lt;BR /&gt;
source="/var/raw/logs/sudo.log" host=jumpserver ??????????????????&lt;/P&gt;

&lt;P&gt;1) COMMAND=/usr/local/bin/ssh mex-01&lt;BR /&gt;
2) COMMAND=/usr/local/bin/ssh -q mex-02&lt;BR /&gt;
3) COMMAND=/usr/local/bin/ssh -q mex-03 df -h /apps&lt;/P&gt;

&lt;P&gt;from these above commands i want to extract only (1) and (2) and ignore (3)&lt;/P&gt;</description>
    <pubDate>Sat, 21 Jun 2014 06:02:11 GMT</pubDate>
    <dc:creator>abctx007</dc:creator>
    <dc:date>2014-06-21T06:02:11Z</dc:date>
    <item>
      <title>Extracting data from specific field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-specific-field/m-p/114556#M30298</link>
      <description>&lt;P&gt;hi i tried playing with rex and regex but couldn't figure exact expression. my command field is in 3 different scenarios&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;1) COMMAND=/usr/local/bin/ssh -q host1
2) COMMAND=/usr/local/bin/ssh host1
3) COMMAND=/usr/local/bin/ssh -q host1 df -h
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;i want a search to give my results only in (1) and (2). we have jump server where many users jump via sudo to other users and i want the list of users only who jumped and not who executed command via for loop in scenario (3).&lt;BR /&gt;
source="/var/raw/logs/sudo.log" host=jumpserver ??????????????????&lt;/P&gt;

&lt;P&gt;1) COMMAND=/usr/local/bin/ssh mex-01&lt;BR /&gt;
2) COMMAND=/usr/local/bin/ssh -q mex-02&lt;BR /&gt;
3) COMMAND=/usr/local/bin/ssh -q mex-03 df -h /apps&lt;/P&gt;

&lt;P&gt;from these above commands i want to extract only (1) and (2) and ignore (3)&lt;/P&gt;</description>
      <pubDate>Sat, 21 Jun 2014 06:02:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-specific-field/m-p/114556#M30298</guid>
      <dc:creator>abctx007</dc:creator>
      <dc:date>2014-06-21T06:02:11Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting data from specific field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-specific-field/m-p/114557#M30299</link>
      <description>&lt;P&gt;You don't have to get a single perfect regular expression...&lt;/P&gt;

&lt;P&gt;Here is one alternative&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="/var/raw/logs/sudo.log" host=jumpserver
| where NOT match(COMMAND,"/usr/local/bin/ssh -q \S+ df -h")
| where match(COMMAND,"/usr/local/bin/ssh -q \S+") OR  match(COMMAND,"/usr/local/bin/ssh \S+")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You might not need both of the &lt;CODE&gt;where&lt;/CODE&gt; commands, but I thought that it was a nice illustration.&lt;/P&gt;</description>
      <pubDate>Sat, 21 Jun 2014 18:24:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-specific-field/m-p/114557#M30299</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2014-06-21T18:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting data from specific field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-specific-field/m-p/114558#M30300</link>
      <description>&lt;P&gt;Tks for your help Iguinn but in this case didn't help me, i should have been more clear in my Q. in case (3) command doesn't always be "df -h" it will one of many thousands. i want to ignore "/usr/local/bin/ssh -q host1 *" pretty much anything after host1. and by the way hostname(host1) also changes all the time.&lt;/P&gt;</description>
      <pubDate>Sun, 22 Jun 2014 17:48:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-specific-field/m-p/114558#M30300</guid>
      <dc:creator>abctx007</dc:creator>
      <dc:date>2014-06-22T17:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting data from specific field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-specific-field/m-p/114559#M30301</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="/var/raw/logs/sudo.log" host=jumpserver | regex COMMAND="/usr/local/bin/ssh (-q \w+|\w+)*$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 22 Jun 2014 19:19:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-specific-field/m-p/114559#M30301</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-06-22T19:19:54Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting data from specific field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-specific-field/m-p/114560#M30302</link>
      <description>&lt;P&gt;tks for suggestion but this didn't help. i want to list o/p whose executed "/usr/local/bin/ssh hostname" and "/usr/local/bin/ssh -q hostname" but not "/usr/local/bin/ssh -q hostname *"&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jun 2014 17:54:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-specific-field/m-p/114560#M30302</guid>
      <dc:creator>abctx007</dc:creator>
      <dc:date>2014-06-23T17:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting data from specific field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-specific-field/m-p/114561#M30303</link>
      <description>&lt;P&gt;How about a sample of actual log data (names/commands obfuscated if you like), and then a representation (not a description) of the results you are seeking to generate.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jun 2014 18:19:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-specific-field/m-p/114561#M30303</guid>
      <dc:creator>grijhwani</dc:creator>
      <dc:date>2014-06-23T18:19:22Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting data from specific field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-specific-field/m-p/114562#M30304</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="/var/raw/logs/sudo.log" host=jumpserver
| where match(COMMAND,"/usr/local/bin/ssh -q \S+\s*$") OR  match(COMMAND,"/usr/local/bin/ssh \S+\s*$")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will only match COMMAND fields that have nothing (or only whitespace) after the host name.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jun 2014 03:58:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-specific-field/m-p/114562#M30304</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2014-06-24T03:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting data from specific field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-specific-field/m-p/114563#M30305</link>
      <description>&lt;P&gt;Tk you very much lguinn that is what i was looking for.appreciate your help.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jun 2014 20:00:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-data-from-specific-field/m-p/114563#M30305</guid>
      <dc:creator>abctx007</dc:creator>
      <dc:date>2014-06-24T20:00:37Z</dc:date>
    </item>
  </channel>
</rss>

