<?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 parse and extract field from my raw data in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-and-extract-field-from-my-raw-data/m-p/621630#M216077</link>
    <description>&lt;P&gt;My bad reading your screenshot, I saw commas - however, although you don't have commas in your data, the extract command can still separate out the line feed separators, as in this example&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="peak.allocated
31660
total.allocated
423084723094
c
2"
| extract kvdelim="\n" pairdelim="\n"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;but it would rely on well formatted data. However, this solution is really only a hack solution to read already ingested data like that.&lt;/P&gt;</description>
    <pubDate>Mon, 21 Nov 2022 22:22:06 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2022-11-21T22:22:06Z</dc:date>
    <item>
      <title>How to parse and extract field from my raw data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-and-extract-field-from-my-raw-data/m-p/621497#M216033</link>
      <description>&lt;P&gt;I Have a log like this, how do I Parse it into fields??&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="imam28_1-1668996713542.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/22563i76E71C8E668C010C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="imam28_1-1668996713542.png" alt="imam28_1-1668996713542.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Is there a way to use Splunk to parse this and extract one value? If so, how?&lt;/P&gt;
&lt;P&gt;Thank you in advance.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Imam&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 03:44:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-and-extract-field-from-my-raw-data/m-p/621497#M216033</guid>
      <dc:creator>imam28</dc:creator>
      <dc:date>2022-11-21T03:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse and extract field from my raw data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-and-extract-field-from-my-raw-data/m-p/621498#M216034</link>
      <description>&lt;P&gt;Looking at that data, it appears to be field name/field value pairs separated by line feeds, so a simple mechanism in SPL is to do&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| extract kvdelim="," pairdelim="\n"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;which will extract the field names/values from the _raw field&lt;/P&gt;&lt;P&gt;However, you should really extract these at ingest time, but that will depend on how your data is being ingested. Is the data coming in as a multi-row event. If you take a file containing a number of events, you can use the 'Add data' option to play with ingesting that data, so the fields are extracted automatically&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 02:25:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-and-extract-field-from-my-raw-data/m-p/621498#M216034</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2022-11-21T02:25:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse and extract field from my raw data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-and-extract-field-from-my-raw-data/m-p/621543#M216047</link>
      <description>&lt;P&gt;The screenshot doesn't show any comma, or anything that clearly signifies a separation of field name from field value for &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;'s method to succeed. &amp;nbsp;If that is the raw log, your best bet is to go back to developers of the code and ask for better logging. &amp;nbsp;There is no excuse to write such poorly formatted logs. &amp;nbsp;If it is not raw log, you should illustrate raw data (in text, anonymize as needed).&lt;/P&gt;&lt;P&gt;There are some workarounds if certain assumptions holds, but they will not work 100%.&lt;/P&gt;&lt;P&gt;First, I assume that each line that contains a string like abc.efg represents a field name, and lines that do not contain this pattern are values.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval data=split(_raw, "
")
| mvexpand data
| rex field=data mode=sed "s/^([^\.]+)\.(.+)/\1_\2=/"
| stats list(data) as _raw
| eval _raw = mvjoin(_raw, " ")
| rex mode=sed "s/= /=/g"
| kv&lt;/LI-CODE&gt;&lt;P&gt;This will (kinda) work till it gets to the line &lt;EM&gt;db.0&lt;/EM&gt;. &amp;nbsp;The next line is &lt;U&gt;overhead.hashtable.main&lt;/U&gt;. (With two dots.) &amp;nbsp;Is this a field name or a field value? &amp;nbsp;Using the above method, you'll get something like&amp;nbsp;db.0=overhead.hashtable.main=14912, which the kv (extract) command will extract into field name &lt;FONT face="andale mono,times"&gt;db_0&lt;/FONT&gt;, value&amp;nbsp;&lt;EM&gt;overhead_hashtable_main=14912&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;An less versatile method could be to assume that each "odd numbered" line is a field name, other lines will be field value.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex mode=sed "s/\n/=/1"
| rex mode=sed "s/\n/=/2"
| rex mode=sed "s/\n/=/3"
...
| rex mode=sed "s/\n/=/10" ``` illustrated data seems to have 19 lines ```
| kv&lt;/LI-CODE&gt;&lt;P&gt;Again, this kinda works till it gets to the line db.0. &amp;nbsp;It will transform into db.0=overhead.hashtable.main, and 14912. &amp;nbsp;Splunk will then extract field name &lt;FONT face="andale mono,times"&gt;db_0&lt;/FONT&gt; with value&amp;nbsp;&lt;EM&gt;overhead.hashtable.main&lt;/EM&gt;, and field name &lt;FONT face="andale mono,times"&gt;14912&lt;/FONT&gt; with null value.&lt;/P&gt;&lt;P&gt;Either way, these are very tortured methods. &amp;nbsp;Application developers ought to do better logging than this.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 09:50:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-and-extract-field-from-my-raw-data/m-p/621543#M216047</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-11-21T09:50:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse and extract field from my raw data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-and-extract-field-from-my-raw-data/m-p/621630#M216077</link>
      <description>&lt;P&gt;My bad reading your screenshot, I saw commas - however, although you don't have commas in your data, the extract command can still separate out the line feed separators, as in this example&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="peak.allocated
31660
total.allocated
423084723094
c
2"
| extract kvdelim="\n" pairdelim="\n"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;but it would rely on well formatted data. However, this solution is really only a hack solution to read already ingested data like that.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 22:22:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-and-extract-field-from-my-raw-data/m-p/621630#M216077</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2022-11-21T22:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse and extract field from my raw data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-and-extract-field-from-my-raw-data/m-p/622050#M216218</link>
      <description>&lt;P&gt;where i write this command , in search or transform.conf?&lt;/P&gt;</description>
      <pubDate>Fri, 25 Nov 2022 06:41:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-and-extract-field-from-my-raw-data/m-p/622050#M216218</guid>
      <dc:creator>imam28</dc:creator>
      <dc:date>2022-11-25T06:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse and extract field from my raw data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-and-extract-field-from-my-raw-data/m-p/622052#M216220</link>
      <description>&lt;P&gt;These are all search time examples&lt;/P&gt;</description>
      <pubDate>Fri, 25 Nov 2022 06:45:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-and-extract-field-from-my-raw-data/m-p/622052#M216220</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2022-11-25T06:45:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse and extract field from my raw data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-and-extract-field-from-my-raw-data/m-p/622059#M216221</link>
      <description>&lt;P&gt;I have followed the command, but there are some that still haven't extracted what is the solution?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="imam28_0-1669362179912.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/22638i77797251C0213F5D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="imam28_0-1669362179912.png" alt="imam28_0-1669362179912.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Nov 2022 07:44:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-and-extract-field-from-my-raw-data/m-p/622059#M216221</guid>
      <dc:creator>imam28</dc:creator>
      <dc:date>2022-11-25T07:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse and extract field from my raw data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-and-extract-field-from-my-raw-data/m-p/622130#M216252</link>
      <description>&lt;P&gt;That is the exact problem&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;&amp;nbsp;and I pointed out: Poorly written logs. &amp;nbsp;You really need to ask coders to write logs that leaves no ambiguity, that is conducive to extraction by mechanical tools like Splunk.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Nov 2022 23:06:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-and-extract-field-from-my-raw-data/m-p/622130#M216252</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-11-25T23:06:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse and extract field from my raw data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-and-extract-field-from-my-raw-data/m-p/622211#M216286</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/249337"&gt;@imam28&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem you have is that db.0 has no 'value' following it on the next row, so no simple regular extraction will work.&lt;/P&gt;&lt;P&gt;Can you post the _raw view of that event.&lt;/P&gt;&lt;P&gt;Just wondering what it's showing, whether it's a multivalue field, where perhaps the "value" for db.0 is a null value, in which case it may be possible to extract it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Nov 2022 21:40:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-and-extract-field-from-my-raw-data/m-p/622211#M216286</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2022-11-27T21:40:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse and extract field from my raw data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-and-extract-field-from-my-raw-data/m-p/622224#M216291</link>
      <description>&lt;P&gt;Correct, db.0 in the next raw has no value in the next raw&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2022 04:08:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-and-extract-field-from-my-raw-data/m-p/622224#M216291</guid>
      <dc:creator>imam28</dc:creator>
      <dc:date>2022-11-28T04:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse and extract field from my raw data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-and-extract-field-from-my-raw-data/m-p/622227#M216292</link>
      <description>&lt;P&gt;it is log event , only db.0 haven't value&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="imam28_1-1669608668647.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/22652iA47B2419479A2199/image-size/medium?v=v2&amp;amp;px=400" role="button" title="imam28_1-1669608668647.png" alt="imam28_1-1669608668647.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2022 04:13:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-and-extract-field-from-my-raw-data/m-p/622227#M216292</guid>
      <dc:creator>imam28</dc:creator>
      <dc:date>2022-11-28T04:13:41Z</dc:date>
    </item>
  </channel>
</rss>

