<?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: Splunk Rex Field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572360#M199480</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/235370"&gt;@IZ88&lt;/a&gt;&amp;nbsp;champion,&lt;/P&gt;&lt;P&gt;I hope you can help me.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I run the below 1,2,3 queries on the given datasets to find out which users ran the enable command on which host at what time:&lt;/P&gt;&lt;P&gt;1. index= networking user* enable* host*&lt;/P&gt;&lt;P&gt;Oct 15 08:17:45 brg-c-1.com.au 8279: Oct 15 2021 08:17:44.820 AEST: %PARSER-5-CFGLOG_LOGGEDCMD: User:John logged command:!exec: enable&lt;BR /&gt;Oct 15 08:17:35 brg-c-1.com.au 8278: Oct 15 2021 08:17:34.082 AEST: %PARSER-5-CFGLOG_LOGGEDCMD: User:lili logged command:!exec: enable failed&lt;BR /&gt;Sep 15 23:29:55 gsw-r-4.com.au 466: Sep 15 23:29:54.009: %PARSER-5-CFGLOG_LOGGEDCMD: User:Khan logged command:!exec: enable&lt;BR /&gt;Aug 12 15:18:37 edc-r-4.com.au 02: Aug 12 15:18:36.472: %PARSER-5-CFGLOG_LOGGEDCMD: User:Khan logged command:!exec: enable&lt;BR /&gt;Aug 11 03:31:05 ctc-s.com.au 134: Aug 10 17:31:04.859: %PARSER-5-CFGLOG_LOGGEDCMD: User:cijs logged command:!exec: enable&lt;BR /&gt;Jan 29 11:30:58 brg-c-1.com.au 2082: Jan 29 2021 11:30:57.141 AEST: %PARSER-5-CFGLOG_LOGGEDCMD: User:chick logged command:!exec: enable failed&lt;/P&gt;&lt;P&gt;2. index=linux_logs host=edc-03-tacacs enable*&lt;/P&gt;&lt;P&gt;Oct 26 12:56:13 egc-03-ts tc_plus[149]: enable query for 'kim' tty86 from 202.168.5.22 accepted&lt;BR /&gt;Oct 26 11:33:44 egc-03-ts tc_plus[259]: enable query for 'kim' tty86 from 202.168.5.22 accepted&lt;BR /&gt;Oct 21 11:35:59 egc-03-ts tc_plus[285]: enable query for 'John' tty86 from 202.168.5.23 accepted&lt;BR /&gt;Oct 21 11:35:53 egc-03-ts tc_plus[282]: enable query for 'Han' tty86 from 202.168.5.23 rejected&lt;/P&gt;&lt;P&gt;3. index=linux_logs host=gsw-03-tacacs enable*&lt;/P&gt;&lt;P&gt;Sep 30 13:35:53 gdw-02-ts tc_plus[143]: 192.168.2.21 James tty1 192.168.6.56 stop task_id=55161 timezone=AEST service=shell start_time=1632972953 priv-lvl=0 cmd=enable&lt;BR /&gt;Sep 29 12:38:17 gdw-02-ts tc_plus[319]: 192.168.2.24 linda tty1 192.168.5.3 stop task_id=15729 timezone=AEST service=shell start_time=1632883097 priv-lvl=0 cmd=enable&lt;BR /&gt;Sep 15 22:23:23 gdw-02-ts tc_plus[1649]: 192.168.4.2 Brown tty322 192.168.46.1 stop task_id=2574 timezone=AEST service=shell start_time=1631708603 priv-lvl=0 cmd=enable&lt;BR /&gt;Sep 9 14:58:32 gdw-02-ts tc_plus[2030]: 192.168.2.29 Gordan tty1 192.168.26.3 stop task_id=14329 timezone=AEST service=shell start_time=1631163512 priv-lvl=0 cmd=enable&lt;/P&gt;&lt;P&gt;I tried hard but could not find a query to merge all these data (indexes and hosts) to find out who ran enable command successfully at what time on which host. And get those results to a table look like&lt;/P&gt;&lt;P&gt;|table date host user command(enable) status(success)&lt;/P&gt;&lt;P&gt;Could anyone please help me ?&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;</description>
    <pubDate>Tue, 26 Oct 2021 03:22:51 GMT</pubDate>
    <dc:creator>GRC</dc:creator>
    <dc:date>2021-10-26T03:22:51Z</dc:date>
    <item>
      <title>How to extract Splunk rex field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572177#M199420</link>
      <description>&lt;P&gt;Hi There,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a query that I use to extract all database modifications. However, I want to exclude SELECT from capturing via this query. I want to extract only INSERT, DELETE, UPDATE.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My Query:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index="database_db" source=database_audit sourcetype="database_audit"

| eval "Database Modifications:" = "Modification on " + host, "Date and Time" = EXTENDED_TIMESTAMP_NY, "Type" = SQL_TEXT, "User" = DB_USER , "Source" = sourcetype

| rex field=_raw "SQL_TEXT=\S(?P&amp;lt;Type&amp;gt;\W?......)\s"
| rex field=_raw "DB_USER=(?P&amp;lt;UserName&amp;gt;..........)"

| table "Date and Time", "Database Modifications:" ,"Type", "User", "Source"&lt;/LI-CODE&gt;
&lt;P&gt;Can anybody help ?&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2022 04:50:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572177#M199420</guid>
      <dc:creator>GRC</dc:creator>
      <dc:date>2022-03-17T04:50:38Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Rex Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572212#M199428</link>
      <description>&lt;P&gt;Hi GRC,&lt;/P&gt;&lt;P&gt;table command will show all columns provided even if they don't exist in some (or all event). So even if the REX command won't capture SELECT, events that has SELECT in their query will still show in your final table, only without any value under the column of "Type".&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you wish to exclude SELECT from your table you can simply add:&lt;/P&gt;&lt;P&gt;| where Type!="SELECT"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 08:57:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572212#M199428</guid>
      <dc:creator>IZ88</dc:creator>
      <dc:date>2021-10-25T08:57:49Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Rex Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572219#M199429</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/235370"&gt;@IZ88&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;You are correct, even if I exclude select with |where Type!="SELECT", I still get "Select" in the table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know how can I exclude select fully ?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 09:31:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572219#M199429</guid>
      <dc:creator>GRC</dc:creator>
      <dc:date>2021-10-25T09:31:51Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Rex Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572220#M199430</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/239922"&gt;@GRC&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry for misleading you, instead of "where" use "search"&lt;/P&gt;&lt;P&gt;|search Type!="SELECT"&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 09:42:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572220#M199430</guid>
      <dc:creator>IZ88</dc:creator>
      <dc:date>2021-10-25T09:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Rex Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572233#M199437</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/235370"&gt;@IZ88&lt;/a&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I completely eliminated Select with this one..&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;| search "Database Modifications:"="Modification on *"&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;NOT select | rex field=_raw "SQL_TEXT=\S(?P&amp;lt;Type&amp;gt;\W?......)\s"&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GRC_1-1635157113057.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/16568i582C544DBB97F173/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GRC_1-1635157113057.png" alt="GRC_1-1635157113057.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have another question:&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this below mentioned dataset. I want to create a conditional query.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ex: I want to check first whether rsyslog service is stopped, if it stopped then who stopped it, in which server. Can you please help ?&lt;/P&gt;&lt;P&gt;Oct 25 16:30:06 keybox sudosh: KHYJS6PxEI64zG Henry: service rsyslog start&lt;BR /&gt;Oct 25 16:30:02 keybox sudosh: KHYJS6PxEI64zG Joseph: #011service rsyslog stop&lt;BR /&gt;Oct 25 15:15:30 keybox sudosh: ssNjFZca22OvaB Henry: service rsyslog stop&lt;BR /&gt;Oct 25 15:08:26 keybox sudosh: ssNjFZla22OvaB Henry: #011service rsyslog start&lt;BR /&gt;Oct 25 15:07:46 keybox sudosh: ssNjFZla22OvaB Joseph: service rsyslog status&lt;BR /&gt;Oct 25 15:06:21 keybox sudosh: ssNjF0la22OvaB Asher: service rsyslog statuts&amp;#127;&amp;#127;s&lt;BR /&gt;Oct 25 14:49:57 eqc-03-tpp sudosh: gkrMz1dLey0CS1 John: cat /etc/red#011#177#177#177#177#177#177#177#177#177#177#177#177#177#177#177r#177#177#177#177#177#177#177#177#177#177#177#177#177sys#177#177ervice rsyslog status&lt;BR /&gt;Oct 25 14:48:26 keybox sudosh: VSjTDhPH3iM5MY Ahser: service rsyslog status&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;Thank you&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 10:32:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572233#M199437</guid>
      <dc:creator>GRC</dc:creator>
      <dc:date>2021-10-25T10:32:30Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Rex Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572240#M199441</link>
      <description>&lt;P&gt;I'm assuming each line is a separate event:&lt;/P&gt;&lt;P&gt;| rex field=_raw "(?&amp;lt;date&amp;gt;\w{3} \d+ \d+:\d+:\d+) (?&amp;lt;var_name&amp;gt;.+) (?&amp;lt;lnx_command&amp;gt;\w+): (?&amp;lt;var_name2&amp;gt;\w+) (?&amp;lt;user&amp;gt;\w+): (?&amp;lt;sys_command&amp;gt;.*)"&lt;/P&gt;&lt;P&gt;| search sys_command="*rsyslog stop"&lt;/P&gt;&lt;P&gt;| table date user &amp;lt;the var_name thats correspond with your server name&amp;gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If your events are parsed into fields, you just need to search the relevant field for the values you desire.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 10:59:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572240#M199441</guid>
      <dc:creator>IZ88</dc:creator>
      <dc:date>2021-10-25T10:59:47Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Rex Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572349#M199474</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/235370"&gt;@IZ88&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thank you. This solved my problem. I marked it as solution and gave you thumbs up.&lt;/P&gt;&lt;P&gt;Thank you so much for the help.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 23:43:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572349#M199474</guid>
      <dc:creator>GRC</dc:creator>
      <dc:date>2021-10-25T23:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Rex Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572360#M199480</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/235370"&gt;@IZ88&lt;/a&gt;&amp;nbsp;champion,&lt;/P&gt;&lt;P&gt;I hope you can help me.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I run the below 1,2,3 queries on the given datasets to find out which users ran the enable command on which host at what time:&lt;/P&gt;&lt;P&gt;1. index= networking user* enable* host*&lt;/P&gt;&lt;P&gt;Oct 15 08:17:45 brg-c-1.com.au 8279: Oct 15 2021 08:17:44.820 AEST: %PARSER-5-CFGLOG_LOGGEDCMD: User:John logged command:!exec: enable&lt;BR /&gt;Oct 15 08:17:35 brg-c-1.com.au 8278: Oct 15 2021 08:17:34.082 AEST: %PARSER-5-CFGLOG_LOGGEDCMD: User:lili logged command:!exec: enable failed&lt;BR /&gt;Sep 15 23:29:55 gsw-r-4.com.au 466: Sep 15 23:29:54.009: %PARSER-5-CFGLOG_LOGGEDCMD: User:Khan logged command:!exec: enable&lt;BR /&gt;Aug 12 15:18:37 edc-r-4.com.au 02: Aug 12 15:18:36.472: %PARSER-5-CFGLOG_LOGGEDCMD: User:Khan logged command:!exec: enable&lt;BR /&gt;Aug 11 03:31:05 ctc-s.com.au 134: Aug 10 17:31:04.859: %PARSER-5-CFGLOG_LOGGEDCMD: User:cijs logged command:!exec: enable&lt;BR /&gt;Jan 29 11:30:58 brg-c-1.com.au 2082: Jan 29 2021 11:30:57.141 AEST: %PARSER-5-CFGLOG_LOGGEDCMD: User:chick logged command:!exec: enable failed&lt;/P&gt;&lt;P&gt;2. index=linux_logs host=edc-03-tacacs enable*&lt;/P&gt;&lt;P&gt;Oct 26 12:56:13 egc-03-ts tc_plus[149]: enable query for 'kim' tty86 from 202.168.5.22 accepted&lt;BR /&gt;Oct 26 11:33:44 egc-03-ts tc_plus[259]: enable query for 'kim' tty86 from 202.168.5.22 accepted&lt;BR /&gt;Oct 21 11:35:59 egc-03-ts tc_plus[285]: enable query for 'John' tty86 from 202.168.5.23 accepted&lt;BR /&gt;Oct 21 11:35:53 egc-03-ts tc_plus[282]: enable query for 'Han' tty86 from 202.168.5.23 rejected&lt;/P&gt;&lt;P&gt;3. index=linux_logs host=gsw-03-tacacs enable*&lt;/P&gt;&lt;P&gt;Sep 30 13:35:53 gdw-02-ts tc_plus[143]: 192.168.2.21 James tty1 192.168.6.56 stop task_id=55161 timezone=AEST service=shell start_time=1632972953 priv-lvl=0 cmd=enable&lt;BR /&gt;Sep 29 12:38:17 gdw-02-ts tc_plus[319]: 192.168.2.24 linda tty1 192.168.5.3 stop task_id=15729 timezone=AEST service=shell start_time=1632883097 priv-lvl=0 cmd=enable&lt;BR /&gt;Sep 15 22:23:23 gdw-02-ts tc_plus[1649]: 192.168.4.2 Brown tty322 192.168.46.1 stop task_id=2574 timezone=AEST service=shell start_time=1631708603 priv-lvl=0 cmd=enable&lt;BR /&gt;Sep 9 14:58:32 gdw-02-ts tc_plus[2030]: 192.168.2.29 Gordan tty1 192.168.26.3 stop task_id=14329 timezone=AEST service=shell start_time=1631163512 priv-lvl=0 cmd=enable&lt;/P&gt;&lt;P&gt;I tried hard but could not find a query to merge all these data (indexes and hosts) to find out who ran enable command successfully at what time on which host. And get those results to a table look like&lt;/P&gt;&lt;P&gt;|table date host user command(enable) status(success)&lt;/P&gt;&lt;P&gt;Could anyone please help me ?&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 03:22:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572360#M199480</guid>
      <dc:creator>GRC</dc:creator>
      <dc:date>2021-10-26T03:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Rex Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572400#M199497</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/235370"&gt;@IZ88&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I tried to capture the server names from below data:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Oct 15 08:17:45&amp;nbsp;&lt;U&gt;brg-c-1.com.au&lt;/U&gt;&amp;nbsp;8279: Oct 15 2021 08:17:44.820 AEST: %PARSER-5-CFGLOG_LOGGEDCMD: User:John logged command:!exec: enable&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Oct 15 08:17:35&amp;nbsp;&lt;U&gt;brg-c-1.com.au&lt;/U&gt;&amp;nbsp;8278: Oct 15 2021 08:17:34.082 AEST: %PARSER-5-CFGLOG_LOGGEDCMD: User:lili logged command:!exec: enable failed&lt;BR /&gt;Aug 11 03:31:05&amp;nbsp;&lt;U&gt;ctc-s.com.au&lt;/U&gt;&amp;nbsp;134: Aug 10 17:31:04.859: %PARSER-5-CFGLOG_LOGGEDCMD: User:cijs logged command:!exec: enable&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;with the following rex command, but it won't work, can you please help me to see what is wrong ?&lt;/P&gt;&lt;P&gt;| rex field=_raw "\/(?&amp;lt;hostname&amp;gt;[^_\/]+)[\w\.]+$"&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 09:22:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572400#M199497</guid>
      <dc:creator>GRC</dc:creator>
      <dc:date>2021-10-26T09:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Rex Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572422#M199503</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/239922"&gt;@GRC&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem seems to be with your regex.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If all your logs follow the same pattern, the line below should capture what you want:&lt;/P&gt;&lt;P&gt;| rex field=_raw ":\d+ (?&amp;lt;hostname&amp;gt;.+) \d+: \w+"&lt;/P&gt;&lt;P&gt;Basically, what you put after the &amp;lt;field_name&amp;gt; defines what the regex should catch.&amp;nbsp; Any thing outside the () represents the data surrounding your desired extraction .&lt;/P&gt;&lt;P&gt;So if the pattern you're looking for repeat several times within the field you work on, it would be good practice to provide some regex\precise phrases for the surrounding data, to make sure you capture exactly what you need.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 10:47:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572422#M199503</guid>
      <dc:creator>IZ88</dc:creator>
      <dc:date>2021-10-26T10:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Rex Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572426#M199505</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/235370"&gt;@IZ88&lt;/a&gt;&amp;nbsp;Woww....That worked wonders. I really appreciate the explanation.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 10:57:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572426#M199505</guid>
      <dc:creator>GRC</dc:creator>
      <dc:date>2021-10-26T10:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Rex Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572431#M199509</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/235370"&gt;@IZ88&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Could you please help me ? I really appreciate.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I run the below 1,2,3 queries on the given datasets to find out which users ran the enable command on which host at what time:&lt;/P&gt;&lt;P&gt;1. index= networking user* enable* host*&lt;/P&gt;&lt;P&gt;Oct 15 08:17:45 brg-c-1.com.au 8279: Oct 15 2021 08:17:44.820 AEST: %PARSER-5-CFGLOG_LOGGEDCMD: User:John logged command:!exec: enable&lt;BR /&gt;Oct 15 08:17:35 brg-c-1.com.au 8278: Oct 15 2021 08:17:34.082 AEST: %PARSER-5-CFGLOG_LOGGEDCMD: User:lili logged command:!exec: enable failed&lt;BR /&gt;Sep 15 23:29:55 gsw-r-4.com.au 466: Sep 15 23:29:54.009: %PARSER-5-CFGLOG_LOGGEDCMD: User:Khan logged command:!exec: enable&lt;BR /&gt;Aug 12 15:18:37 edc-r-4.com.au 02: Aug 12 15:18:36.472: %PARSER-5-CFGLOG_LOGGEDCMD: User:Khan logged command:!exec: enable&lt;BR /&gt;Aug 11 03:31:05 ctc-s.com.au 134: Aug 10 17:31:04.859: %PARSER-5-CFGLOG_LOGGEDCMD: User:cijs logged command:!exec: enable&lt;BR /&gt;Jan 29 11:30:58 brg-c-1.com.au 2082: Jan 29 2021 11:30:57.141 AEST: %PARSER-5-CFGLOG_LOGGEDCMD: User:chick logged command:!exec: enable failed&lt;/P&gt;&lt;P&gt;2. index=linux_logs host=edc-03-tacacs enable*&lt;/P&gt;&lt;P&gt;Oct 26 12:56:13 egc-03-ts tc_plus[149]: enable query for 'kim' tty86 from 202.168.5.22 accepted&lt;BR /&gt;Oct 26 11:33:44 egc-03-ts tc_plus[259]: enable query for 'kim' tty86 from 202.168.5.22 accepted&lt;BR /&gt;Oct 21 11:35:59 egc-03-ts tc_plus[285]: enable query for 'John' tty86 from 202.168.5.23 accepted&lt;BR /&gt;Oct 21 11:35:53 egc-03-ts tc_plus[282]: enable query for 'Han' tty86 from 202.168.5.23 rejected&lt;/P&gt;&lt;P&gt;3. index=linux_logs host=gsw-03-tacacs enable*&lt;/P&gt;&lt;P&gt;Sep 30 13:35:53 gdw-02-ts tc_plus[143]: 192.168.2.21 James tty1 192.168.6.56 stop task_id=55161 timezone=AEST service=shell start_time=1632972953 priv-lvl=0 cmd=enable&lt;BR /&gt;Sep 29 12:38:17 gdw-02-ts tc_plus[319]: 192.168.2.24 linda tty1 192.168.5.3 stop task_id=15729 timezone=AEST service=shell start_time=1632883097 priv-lvl=0 cmd=enable&lt;BR /&gt;Sep 15 22:23:23 gdw-02-ts tc_plus[1649]: 192.168.4.2 Brown tty322 192.168.46.1 stop task_id=2574 timezone=AEST service=shell start_time=1631708603 priv-lvl=0 cmd=enable&lt;BR /&gt;Sep 9 14:58:32 gdw-02-ts tc_plus[2030]: 192.168.2.29 Gordan tty1 192.168.26.3 stop task_id=14329 timezone=AEST service=shell start_time=1631163512 priv-lvl=0 cmd=enable&lt;/P&gt;&lt;P&gt;I tried hard but could not find a query to merge all these data (indexes and hosts) to find out who ran enable command successfully at what time on which host. And get those results to a table look like&lt;/P&gt;&lt;P&gt;|table date host user command(enable) status(success)&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 11:13:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572431#M199509</guid>
      <dc:creator>GRC</dc:creator>
      <dc:date>2021-10-26T11:13:12Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Rex Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572437#M199511</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/239922"&gt;@GRC&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you wish to query multiple indexes you can you the "append" command.&lt;/P&gt;&lt;P&gt;The syntax will be:&lt;/P&gt;&lt;P&gt;index= networking user* enable* host*&lt;BR /&gt;| append [search index=linux_logs host=edc-03-tacacs enable*]&lt;BR /&gt;| append [search index=linux_logs host=gsw-03-tacacs enable*]&lt;/P&gt;&lt;P&gt;Or, you can combine the 2 appends since they search the same index&lt;/P&gt;&lt;P&gt;index= networking user* enable* host*&lt;BR /&gt;| append [search index=linux_logs (host=edc-03-tacacs OR host=gsw-03-tacacs) enable*]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you need to use the REX command you can do it either separately for each part of the search&lt;/P&gt;&lt;P&gt;index= networking user* enable* host*&lt;BR /&gt;| rex field=_raw "......"&lt;BR /&gt;| append [search index=linux_logs host=edc-03-tacacs enable* | rex field=_raw "......"]&lt;BR /&gt;| append [search index=linux_logs host=gsw-03-tacacs enable* | rex field=_raw "......"]&lt;/P&gt;&lt;P&gt;or if you feel comfortable enough with regex, use just one REX command after appending all necessary searches:&lt;/P&gt;&lt;P&gt;index= networking user* enable* host*&lt;BR /&gt;| append [search index=linux_logs host=edc-03-tacacs enable*]&lt;BR /&gt;| append [search index=linux_logs host=gsw-03-tacacs enable*]&lt;BR /&gt;| rex field=_raw "......"&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 12:23:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572437#M199511</guid>
      <dc:creator>IZ88</dc:creator>
      <dc:date>2021-10-26T12:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Rex Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572442#M199514</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/235370"&gt;@IZ88&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thank you for the append query.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to build the rex command. Let's say this one..&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Oct 15 08:17:45 brg-c-1.com.au 8279: Oct 15 2021 08:17:44.820 AEST: %PARSER-5-CFGLOG_LOGGEDCMD: User:John logged command:!exec: enable&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Oct 15 08:17:35 brg-c-1.com.au 8278: Oct 15 2021 08:17:34.082 AEST: %PARSER-5-CFGLOG_LOGGEDCMD: User:lili logged command:!exec: enable failed&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Sep 15 23:29:55 gsw-r-4.com.au 466: Sep 15 23:29:54.009: %PARSER-5-CFGLOG_LOGGEDCMD: User:Khan logged command:!exec: enable&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Aug 12 15:18:37 edc-r-4.com.au 02: Aug 12 15:18:36.472: %PARSER-5-CFGLOG_LOGGEDCMD: User:Khan logged command:!exec: enable&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Aug 11 03:31:05 ctc-s.com.au 134: Aug 10 17:31:04.859: %PARSER-5-CFGLOG_LOGGEDCMD: User:cijs logged command:!exec: enable&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jan 29 11:30:58 brg-c-1.com.au 2082: Jan 29 2021 11:30:57.141 AEST: %PARSER-5-CFGLOG_LOGGEDCMD: User:chick logged command:!exec: enable failed&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I build the query like this to create a table and capture who used the enabled command on which host on which date.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But it does not seem to be working. If I can get this query right I think I can apply it in the append you showed me. Can you please help me to figure out what is wrong with this ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;index= networking&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;| rex field=_raw "(?&amp;lt;Date&amp;gt;\w{3} \d+ \d+:\d+:\d+)(?&amp;lt;user&amp;gt;\w+)(:\d+ (?&amp;lt;hostname&amp;gt;.+) \d+: \w+)(?&amp;lt;command&amp;gt;)"&lt;/P&gt;&lt;P&gt;| search command="enable"&lt;/P&gt;&lt;P&gt;| table Date hostname User Command&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 12:49:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572442#M199514</guid>
      <dc:creator>GRC</dc:creator>
      <dc:date>2021-10-26T12:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Rex Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572450#M199516</link>
      <description>&lt;P&gt;The first part of your regex:&amp;nbsp;&lt;SPAN&gt;(?&amp;lt;Date&amp;gt;\w{3} \d+ \d+:\d+:\d+) can be matched twice within _raw&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The first time at the beginning of the event, and the second time a bit further down the line.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You can use the following (assuming that I guessed some of your desired fields correctly)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;| rex field=_raw "^(?&amp;lt;Date&amp;gt;\w{3} \d+ \d+:\d+:\d+) (?&amp;lt;hostname&amp;gt;.+) \d+: \w{3}.*User:(?&amp;lt;user&amp;gt;\w+).*:(?&amp;lt;command&amp;gt;.*)$"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;few things to note:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1. Field names are case sensitive, so your table command must call the field exactly as you name it ("Command"!="command")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2. The regex for field extraction in REX is the following: (?&amp;lt;field_name&amp;gt;SOME_REGEX) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-you must have some regex after the field name (in your example &amp;lt;command&amp;gt; is missing regex)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-each extraction should be within a single parenthesis (your &amp;lt;hostname&amp;gt; extraction is within double parenthesis)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -the extractions should be written in the exact order they appear in the field you're working on (it looks like you mixed the order in your extraction)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 13:23:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572450#M199516</guid>
      <dc:creator>IZ88</dc:creator>
      <dc:date>2021-10-26T13:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Rex Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572574#M199557</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/235370"&gt;@IZ88&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;You are the only person in the splunk forum who can understand what I want and can exactly deliver. Thank you so much.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;However, I still have a trouble getting the thing sorted.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I found that there are two time formats as shown in the below image. So when I ran the following command only a specific time is captured.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please help me ?&lt;/P&gt;&lt;P&gt;This is&amp;nbsp;&lt;A href="https://regex101.com/" target="_blank"&gt;https://regex101.com/&lt;/A&gt;&amp;nbsp;screenshot. The query can only capture the single dot time stamp.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GRC_0-1635309133121.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/16602iD63D4F76FC81F148/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GRC_0-1635309133121.png" alt="GRC_0-1635309133121.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Oct 2021 04:32:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572574#M199557</guid>
      <dc:creator>GRC</dc:creator>
      <dc:date>2021-10-27T04:32:51Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Rex Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572575#M199558</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/235370"&gt;@IZ88&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;You are the only person in the splunk forum who can understand what I want and can exactly deliver. Thank you so much.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;However, I still have a trouble getting the thing sorted.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I found that there are two time formats as shown in the below image. So when I ran the following command only a specific time is captured.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please help me ?&lt;/P&gt;&lt;P&gt;This is&amp;nbsp;&lt;A href="https://regex101.com/" target="_blank"&gt;https://regex101.com/&lt;/A&gt;&amp;nbsp;screenshot. The query can only capture the single dot time stamp.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GRC_0-1635309133121.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/16602iD63D4F76FC81F148/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GRC_0-1635309133121.png" alt="GRC_0-1635309133121.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Oct 2021 04:36:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572575#M199558</guid>
      <dc:creator>GRC</dc:creator>
      <dc:date>2021-10-27T04:36:39Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Rex Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572583#M199564</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/239922"&gt;@GRC&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you wish to account for multiple spaces, you can replace each space in the regex with \s+&lt;/P&gt;&lt;P&gt;\s is the regex for space, and the plus sign indicates that it might have more than one consecutive appearance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Oct 2021 06:15:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572583#M199564</guid>
      <dc:creator>IZ88</dc:creator>
      <dc:date>2021-10-27T06:15:57Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Rex Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572587#M199565</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/235370"&gt;@IZ88&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did it :&lt;/P&gt;&lt;P&gt;(?&amp;lt;Date&amp;gt;\w{3}&lt;STRONG&gt;\s&lt;/STRONG&gt; \d+ \d+:\d+:\d+)&lt;/P&gt;&lt;P&gt;Then the query shifted to capture only double dot string. I wonder if there is a way to capture both formats ?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GRC_0-1635316315845.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/16603i8B04D5E71186B91A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GRC_0-1635316315845.png" alt="GRC_0-1635316315845.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 27 Oct 2021 06:32:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572587#M199565</guid>
      <dc:creator>GRC</dc:creator>
      <dc:date>2021-10-27T06:32:53Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Rex Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572593#M199569</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/239922"&gt;@GRC&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The reason your query only captured double dot string is because you accidentally asked it to do so.&lt;/P&gt;&lt;P&gt;Since \s is regex for space and after it you lest the actual space, your query looked for \s\s.&lt;/P&gt;&lt;P&gt;For example, we used "\d+" when looking at the date because we don't know if a single digit day (the 1st-9th of each month) will appear as a single digit (1-9) or double digits (01-09), adding the "+" means that Splunk will match any length of consecutive digit strings.&lt;/P&gt;&lt;P&gt;The same goes when your unsure of how many spaces are between each part of your data.&lt;/P&gt;&lt;P&gt;You can use this query;&lt;/P&gt;&lt;P&gt;(?&amp;lt;Date&amp;gt;\w{3}&lt;STRONG&gt;\s+&lt;/STRONG&gt;\d+ \d+:\d+:\d+)&lt;/P&gt;</description>
      <pubDate>Wed, 27 Oct 2021 06:52:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-Splunk-rex-field/m-p/572593#M199569</guid>
      <dc:creator>IZ88</dc:creator>
      <dc:date>2021-10-27T06:52:47Z</dc:date>
    </item>
  </channel>
</rss>

