<?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: How to extract fields from txt format in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-txt-format/m-p/636248#M220959</link>
    <description>&lt;P&gt;Thanks&amp;nbsp;&lt;SPAN&gt;gcusello, this really helps.&lt;BR /&gt;I am getting values which are prior to , in messages but messages are having thousands of count and those in below pattern. How can I get whole value. Update value on below page.&lt;BR /&gt;&lt;A href="https://regex101.com/r/aPEZ6B/1" target="_blank"&gt;https://regex101.com/r/aPEZ6B/1&lt;/A&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Sample -&lt;BR /&gt;2023-03-21 04:14:13.859, queue_name:stream-AccountProfile, messages: 16,2303, bytes: 13 KiB, actCusumers: 4, numSubjects: 1&lt;BR /&gt;2023-03-21 04:14:13.859, queue_name:stream-SampleProfile, messages: 3,522, bytes: 2.4 MiB, actCusumers: 4, numSubjects: 1&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Mar 2023 06:16:09 GMT</pubDate>
    <dc:creator>drogo</dc:creator>
    <dc:date>2023-03-28T06:16:09Z</dc:date>
    <item>
      <title>How to extract fields from txt format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-txt-format/m-p/635469#M220778</link>
      <description>&lt;P&gt;Hello, I want to extract fiends from below log format. Can someone please help.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Log format -&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;2023-03-21 04:14:13.859, queue_name:stream-AccountProfile, messages: 16, bytes: 13 KiB, actCusumers: 4, numSubjects: 1&lt;BR /&gt;2023-03-21 04:14:13.859, queue_name:stream-SampleProfile, messages: 3,522, bytes: 2.4 MiB, actCusumers: 4, numSubjects: 1&lt;/P&gt;
&lt;P&gt;Fields I want to extract are queue name,&amp;nbsp;messages,&amp;nbsp;actCusumers,&amp;nbsp;numSubjects.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using below eval commands but looks like I am not getting all logs, also getting duplicate events.&lt;/P&gt;
&lt;P&gt;I am want to extract only latest ones.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Query -&amp;nbsp;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;| eval ArrayAttrib=split(_raw,",")&lt;BR /&gt;| eval numSubjects=mvindex(split(mvindex(ArrayAttrib,-1) ,": "),1)&lt;BR /&gt;| eval actConsumers=mvindex(split(mvindex(ArrayAttrib,-2) ,": "),1)&lt;BR /&gt;| eval bytes=mvindex(split(mvindex(ArrayAttrib,-3) ,": "),1)&lt;BR /&gt;| eval messages=mvindex(split(mvindex(ArrayAttrib,-4) ,": "),1)&lt;BR /&gt;| eval stream=mvindex(split(mvindex(ArrayAttrib,-5) ,":"),1)&lt;BR /&gt;| eval dtm=strftime(_time,"%Y-%m-%d %H:%M")&lt;BR /&gt;| stats max(dtm) by stream numSubjects actConsumers bytes messages&lt;BR /&gt;| fields "stream", "messages", "actConsumers", "numSubjects", "max(dtm)"&lt;BR /&gt;| dedup "messages" | dedup "stream" | sort "stream"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 15:37:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-txt-format/m-p/635469#M220778</guid>
      <dc:creator>drogo</dc:creator>
      <dc:date>2023-03-22T15:37:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from txt format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-txt-format/m-p/635470#M220779</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/254896"&gt;@drogo&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;what's your problem rexes to extract fields?&lt;/P&gt;&lt;P&gt;if this is your issue, you can use this regex&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "queue_name:\s*(?&amp;lt;queue_name&amp;gt;[^,]+),\s+messages:\s*(?&amp;lt;messages&amp;gt;[^,]+),.*bytes:\s*(?&amp;lt;bytes&amp;gt;[^,]+),\s*actCusumers:\s*(?&amp;lt;actCusumers&amp;gt;[^,]+),\s*numSubjects:\s*(?&amp;lt;numSubjects&amp;gt;\d+)"&lt;/LI-CODE&gt;&lt;P&gt;that you can test at&amp;nbsp;&lt;A href="https://regex101.com/r/aPEZ6B/1" target="_blank"&gt;https://regex101.com/r/aPEZ6B/1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 08:42:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-txt-format/m-p/635470#M220779</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-03-22T08:42:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from txt format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-txt-format/m-p/635473#M220782</link>
      <description>&lt;P&gt;Try extracting the fields this way (note the renames are required because your sample data doesn't match the field names you are using and I have assumed _time has been extracted properly already)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| extract pairdelim="," kvdelim=":"
| rename queue_name as stream
| rename actCusumers as actConsumers
| stats max(_time) as _time by stream numSubjects actConsumers bytes messages&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;The dedups you have used would have kept the first event for each messages (given that this appears to be just a count(?) you will have lost some data here). This could have been further reduced by the next dedup if you had more than one different messages value for a stream.&lt;/P&gt;&lt;P&gt;What is it that you are actually trying to determine from your events?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 08:59:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-txt-format/m-p/635473#M220782</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-03-22T08:59:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from txt format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-txt-format/m-p/636248#M220959</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;SPAN&gt;gcusello, this really helps.&lt;BR /&gt;I am getting values which are prior to , in messages but messages are having thousands of count and those in below pattern. How can I get whole value. Update value on below page.&lt;BR /&gt;&lt;A href="https://regex101.com/r/aPEZ6B/1" target="_blank"&gt;https://regex101.com/r/aPEZ6B/1&lt;/A&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Sample -&lt;BR /&gt;2023-03-21 04:14:13.859, queue_name:stream-AccountProfile, messages: 16,2303, bytes: 13 KiB, actCusumers: 4, numSubjects: 1&lt;BR /&gt;2023-03-21 04:14:13.859, queue_name:stream-SampleProfile, messages: 3,522, bytes: 2.4 MiB, actCusumers: 4, numSubjects: 1&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 06:16:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-txt-format/m-p/636248#M220959</guid>
      <dc:creator>drogo</dc:creator>
      <dc:date>2023-03-28T06:16:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from txt format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-txt-format/m-p/636251#M220960</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;,&lt;BR /&gt;I got the solution, thanks for your help!&lt;BR /&gt;&lt;A href="https://regex101.com/r/aPEZ6B/1" target="_blank"&gt;https://regex101.com/r/aPEZ6B/1&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 06:41:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-txt-format/m-p/636251#M220960</guid>
      <dc:creator>drogo</dc:creator>
      <dc:date>2023-03-28T06:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from txt format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-txt-format/m-p/636252#M220961</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/254896"&gt;@drogo&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;please try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;^(?&amp;lt;_time&amp;gt;[^,]+),\s+queue_name:\s*(?&amp;lt;queue_name&amp;gt;[^,]+),\s+messages:\s*(?&amp;lt;messages&amp;gt;.+),.*bytes:\s*(?&amp;lt;bytes&amp;gt;[^,]+),\s*actCusumers:\s*(?&amp;lt;actCusumers&amp;gt;[^,]+),\s*numSubjects:\s*(?&amp;lt;numSubjects&amp;gt;\d+)&lt;/LI-CODE&gt;&lt;P&gt;that you can test at&amp;nbsp;&lt;A href="https://regex101.com/r/aPEZ6B/2" target="_blank"&gt;https://regex101.com/r/aPEZ6B/2&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 06:42:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-txt-format/m-p/636252#M220961</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-03-28T06:42:57Z</dc:date>
    </item>
  </channel>
</rss>

