<?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 Splunk Query - How to create a table from event in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Query-How-to-create-a-table-from-event/m-p/446337#M126632</link>
    <description>&lt;P&gt;I'm quite new to Splunk and currently am trying to do a simple with Splunk using syslog. I have a firepower syslog which I need to understand how to do a table of the events but unsuccessfully. &lt;/P&gt;

&lt;P&gt;My current query is &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="syslog"  URL
| rex "^\[(?[^]]+)\]\[(?[^]]+)\]\[(?[^]]+)\] \"(?[^\"]+)\" \[Classification: (?[^]]+)\] \[Priority: (?[^]]+)\] {(?[^}]+)} (?\d+\.\d+\.\d+\.\d+):(?\d+) -\&amp;gt; (?\d+\.\d+\.\d+\.\d+):(?\d+)"
| eval c_time=strftime(_time,"%m/%d/%y %H:%M:%S") 
|table  c_time, src_ip, src_port, dest_ip, dest_port, message, blocked
|rename _time AS "Time", eventtype AS "Event Type", src_port AS "Src Port" , dest_ip AS "Dst" , dest_port AS "Dst Port", ip_proto AS "Protocol", hostname AS "Hostname", message AS "Message", blocked AS "Blocked?", src_ip AS "Src", c_time As "Time"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;From the events, I could see &lt;BR /&gt;
Aug 14 17:47:08 xx.xx.xx.xx Aug 14 09:47:08 firepower SFIMS: Protocol: TCP, SrcIP: xx.xx.xx.xx, OriginalClientIP: ::, DstIP: xx.xx.xx.xx, SrcPort: xxxxx, DstPort: xxx, TCPFlags: 0x0, IngressInterface: CBY-IFW-01/IFW_TRANSIT, EgressInterface: CBY-IFW-01/IFW_OUTSIDE_2, IngressZone: INSIDE_Internet, EgressZone: OUTSIDE_INTERNET_2, Policy: MY_Policy, ConnectType: End, AccessControlRuleName: MY_POLICY, AccessControlRuleAction: Allow, Prefilter Policy: Unknown, UserName: No Authentication Required, Client: SSL client, ApplicationProtocol: HTTPS, WebApplication: Some App, InitiatorPackets: 8, ResponderPackets: 9, InitiatorBytes: 1403, ResponderBytes: 3716, Context: CBY-IFW-01, NAPPolicy: Question Mark, DNSResponseType: No Error, Sinkhole: Unknown, URLCategory: Unknown, URLReputation: Risk unknown, URL: &lt;A href="https://this.splunkquery.com" target="_blank"&gt;https://this.splunkquery.com&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I would like to see a table like the ones below. &lt;BR /&gt;
time | src_ip | dst_ip | URL&lt;/P&gt;

&lt;P&gt;Is it possible? Any help is appreciated.&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 01:43:36 GMT</pubDate>
    <dc:creator>pclooi</dc:creator>
    <dc:date>2020-09-30T01:43:36Z</dc:date>
    <item>
      <title>Splunk Query - How to create a table from event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Query-How-to-create-a-table-from-event/m-p/446337#M126632</link>
      <description>&lt;P&gt;I'm quite new to Splunk and currently am trying to do a simple with Splunk using syslog. I have a firepower syslog which I need to understand how to do a table of the events but unsuccessfully. &lt;/P&gt;

&lt;P&gt;My current query is &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="syslog"  URL
| rex "^\[(?[^]]+)\]\[(?[^]]+)\]\[(?[^]]+)\] \"(?[^\"]+)\" \[Classification: (?[^]]+)\] \[Priority: (?[^]]+)\] {(?[^}]+)} (?\d+\.\d+\.\d+\.\d+):(?\d+) -\&amp;gt; (?\d+\.\d+\.\d+\.\d+):(?\d+)"
| eval c_time=strftime(_time,"%m/%d/%y %H:%M:%S") 
|table  c_time, src_ip, src_port, dest_ip, dest_port, message, blocked
|rename _time AS "Time", eventtype AS "Event Type", src_port AS "Src Port" , dest_ip AS "Dst" , dest_port AS "Dst Port", ip_proto AS "Protocol", hostname AS "Hostname", message AS "Message", blocked AS "Blocked?", src_ip AS "Src", c_time As "Time"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;From the events, I could see &lt;BR /&gt;
Aug 14 17:47:08 xx.xx.xx.xx Aug 14 09:47:08 firepower SFIMS: Protocol: TCP, SrcIP: xx.xx.xx.xx, OriginalClientIP: ::, DstIP: xx.xx.xx.xx, SrcPort: xxxxx, DstPort: xxx, TCPFlags: 0x0, IngressInterface: CBY-IFW-01/IFW_TRANSIT, EgressInterface: CBY-IFW-01/IFW_OUTSIDE_2, IngressZone: INSIDE_Internet, EgressZone: OUTSIDE_INTERNET_2, Policy: MY_Policy, ConnectType: End, AccessControlRuleName: MY_POLICY, AccessControlRuleAction: Allow, Prefilter Policy: Unknown, UserName: No Authentication Required, Client: SSL client, ApplicationProtocol: HTTPS, WebApplication: Some App, InitiatorPackets: 8, ResponderPackets: 9, InitiatorBytes: 1403, ResponderBytes: 3716, Context: CBY-IFW-01, NAPPolicy: Question Mark, DNSResponseType: No Error, Sinkhole: Unknown, URLCategory: Unknown, URLReputation: Risk unknown, URL: &lt;A href="https://this.splunkquery.com" target="_blank"&gt;https://this.splunkquery.com&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I would like to see a table like the ones below. &lt;BR /&gt;
time | src_ip | dst_ip | URL&lt;/P&gt;

&lt;P&gt;Is it possible? Any help is appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:43:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Query-How-to-create-a-table-from-event/m-p/446337#M126632</guid>
      <dc:creator>pclooi</dc:creator>
      <dc:date>2020-09-30T01:43:36Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Query - How to create a table from event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Query-How-to-create-a-table-from-event/m-p/446338#M126633</link>
      <description>&lt;P&gt;The forum formatter mangled your regex strings.  Please edit your question to restore them.  Putting SPL and other code-like text inside backticks will preserve formatting.&lt;/P&gt;

&lt;P&gt;Despite the damage done to the &lt;CODE&gt;rex&lt;/CODE&gt; command, we can see it doesn't match your sample event.  The regex expects &lt;CODE&gt;[&lt;/CODE&gt; as the first character of the event, but there are no brackets anywhere in the data.  Likewise, the texts "Classification:" and "Priority:" are sought, but are not in the event.  Are you sure you gave us the right sample event?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2019 13:21:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Query-How-to-create-a-table-from-event/m-p/446338#M126633</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-08-14T13:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Query - How to create a table from event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Query-How-to-create-a-table-from-event/m-p/446339#M126634</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults 
|  eval payload="Aug 14 17:47:08 xx.xx.xx.xx Aug 14 09:47:08 firepower SFIMS: Protocol: TCP, SrcIP: xx.xx.xx.xx, OriginalClientIP: ::, DstIP: xx.xx.xx.xx, SrcPort: xxxxx, DstPort: xxx, TCPFlags: 0x0, IngressInterface: CBY-IFW-01/IFW_TRANSIT, EgressInterface: CBY-IFW-01/IFW_OUTSIDE_2, IngressZone: INSIDE_Internet, EgressZone: OUTSIDE_INTERNET_2, Policy: MY_Policy, ConnectType: End, AccessControlRuleName: MY_POLICY, AccessControlRuleAction: Allow, Prefilter Policy: Unknown, UserName: No Authentication Required, Client: SSL client, ApplicationProtocol: HTTPS, WebApplication: Some App, InitiatorPackets: 8, ResponderPackets: 9, InitiatorBytes: 1403, ResponderBytes: 3716, Context: CBY-IFW-01, NAPPolicy: Question Mark, DNSResponseType: No Error, Sinkhole: Unknown, URLCategory: Unknown, URLReputation: Risk unknown, URL: &lt;A href="https://this.splunkquery.com&amp;quot;" target="test_blank"&gt;https://this.splunkquery.com"&lt;/A&gt;; 
|  rex field=payload "SrcIP:(?&amp;lt;src_ip&amp;gt;.*?)," 
| rex field=payload "DstIP:(?&amp;lt;dst_ip&amp;gt;.*?)," 
|  rex field=payload "URL:(?&amp;lt;url&amp;gt;.*)" 
|  table _time,src_ip,dest_ip,url
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is simple, but i think you are stuck at someplace..&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2019 15:50:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Query-How-to-create-a-table-from-event/m-p/446339#M126634</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2019-08-14T15:50:04Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Query - How to create a table from event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Query-How-to-create-a-table-from-event/m-p/446340#M126635</link>
      <description>&lt;P&gt;I think this should work too which will extract almost all the fields require :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.. | extract pairdelim="," kvdelim=": " | rex "URL:\s*(?&amp;lt;URL&amp;gt;.*)" 
| table _time SrcIP DstIP URL
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Aug 2019 16:05:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Query-How-to-create-a-table-from-event/m-p/446340#M126635</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2019-08-14T16:05:45Z</dc:date>
    </item>
  </channel>
</rss>

