<?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: Not all fields in log line extracted in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Not-all-fields-in-log-line-extracted/m-p/669048#M229484</link>
    <description>&lt;P&gt;1) Please show the SPL you've tried and tell us how it failed you.&amp;nbsp; It would help to see an actual (sanitized) event, too.&lt;/P&gt;&lt;P&gt;The options to the &lt;FONT face="courier new,courier"&gt;extract&lt;/FONT&gt; command are swapped.&amp;nbsp; &lt;FONT face="courier new,courier"&gt;kvdelim&lt;/FONT&gt; is the character that separates key from value, usually "="; &lt;FONT face="courier new,courier"&gt;pairdelim&lt;/FONT&gt; is the character that separates kv pairs, usually comma or space.&lt;/P&gt;&lt;P&gt;2) The props.conf file has a &lt;FONT face="courier new,courier"&gt;TRUNCATE&lt;/FONT&gt; setting that defaults to 10000.&amp;nbsp; Perhaps your system has a lower value.&lt;/P&gt;</description>
    <pubDate>Fri, 17 Nov 2023 18:46:24 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2023-11-17T18:46:24Z</dc:date>
    <item>
      <title>Not all fields in log line extracted</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Not-all-fields-in-log-line-extracted/m-p/669038#M229479</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have two problems with a log line.&lt;/P&gt;
&lt;P&gt;1)&lt;/P&gt;
&lt;P&gt;I have a log line that occasionally is inserted.&amp;nbsp;&lt;BR /&gt;It is a schedule, and i wish to extract the data from it. The entry has values that are&lt;BR /&gt;eventTitle=&lt;/P&gt;
&lt;P&gt;However, Splunk is only pulling the first occurrence from the log line and ignoring the rest.&lt;/P&gt;
&lt;P&gt;so i get;&lt;BR /&gt;eventTitle=BooRadley&lt;/P&gt;
&lt;P&gt;in my fields, instead of&lt;/P&gt;
&lt;P&gt;eventTitle=BooRadley&lt;/P&gt;
&lt;P&gt;eventTitle=REGGAE-2&lt;/P&gt;
&lt;P&gt;eventTitle=CHRISTIAN MISSION&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tried using regex and&amp;nbsp;| kv pairdelim="=", kvdelim=","&lt;/P&gt;
&lt;P&gt;I am unsure if a line break would work as they are referenced to SArts - This is a field extracted via regex and changes.&lt;/P&gt;
&lt;P&gt;2)&lt;/P&gt;
&lt;P&gt;The log line is about&amp;nbsp;9999 characters long with spaces, and not all the log line is ingested - I think i need to create a limits.conf file?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is an abridged extract of the log line&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;20231117154211 [18080-exec-9] INFO EventConversionService () - SArts: VUpdate(system=GRP1-VIPE, channelCode=UH, type=NextEvents, events=[Event(onAir=true,  eventNumber=725538339, utcStartDateTime=2023-11-17T15:42:10.160Z, duration=00:00:05.000, eventTitle=BooRadley, contentType=Prog ), Event(onAir=false, eventNumber=725538313, utcStartDateTime=2023-11-17T15:42:15.160Z,  duration=00:00:02.000, eventTitle= REGGAE-2, contentType=Bumper), Event(onAir=false, eventNumber=725538320, utcStartDateTime=2023-11-17T15:42:17.160Z,  duration=00:01:30.000,  eventTitle=CHRISITAN MISSION , contentType=Commercial), Event…&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is my code so far;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| rex "\-\s+(?&amp;lt;channel_name&amp;gt;.+)\:\sVUpdate"  | stats  values(eventNumber) by channel_name channelCode utcStartDateTime eventTitle duration  &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2023 17:02:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Not-all-fields-in-log-line-extracted/m-p/669038#M229479</guid>
      <dc:creator>ssaenger</dc:creator>
      <dc:date>2023-11-17T17:02:56Z</dc:date>
    </item>
    <item>
      <title>Re: Not all fields in log line extracted</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Not-all-fields-in-log-line-extracted/m-p/669048#M229484</link>
      <description>&lt;P&gt;1) Please show the SPL you've tried and tell us how it failed you.&amp;nbsp; It would help to see an actual (sanitized) event, too.&lt;/P&gt;&lt;P&gt;The options to the &lt;FONT face="courier new,courier"&gt;extract&lt;/FONT&gt; command are swapped.&amp;nbsp; &lt;FONT face="courier new,courier"&gt;kvdelim&lt;/FONT&gt; is the character that separates key from value, usually "="; &lt;FONT face="courier new,courier"&gt;pairdelim&lt;/FONT&gt; is the character that separates kv pairs, usually comma or space.&lt;/P&gt;&lt;P&gt;2) The props.conf file has a &lt;FONT face="courier new,courier"&gt;TRUNCATE&lt;/FONT&gt; setting that defaults to 10000.&amp;nbsp; Perhaps your system has a lower value.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2023 18:46:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Not-all-fields-in-log-line-extracted/m-p/669048#M229484</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-11-17T18:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: Not all fields in log line extracted</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Not-all-fields-in-log-line-extracted/m-p/669054#M229485</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;P&gt;The log line is about&amp;nbsp;9999 characters long with spaces, and not all the log line is ingested - I think i need to create a limits.conf file?&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Absolutely. &amp;nbsp;Good data is the only guarantee that any work on it will be valid.&lt;/P&gt;&lt;P&gt;This said, Splunk's KV extraction does not look beyond the first occurrence of key. (And that's a good thing. &amp;nbsp;It is a risky proposition for any language to assume the intention of multiple occurrences of a left-hand side value.) The main problem is caused by the developers, who take pains to invent a structured data that is not standard. &amp;nbsp;It seems that they use foo[] to indicate an array (events), then use bar() to indicate an element; inside element, they use = to separate key and value. &amp;nbsp;Then, on top of this, they use geez() to signal a top level structure ("VUpdate") with key-value pairs that includes the events[] array. &amp;nbsp;If you have any influence over developers, you should urge them, beg them, implore them to use a standard structured representation such as JSON.&lt;/P&gt;&lt;P&gt;If not, you can use Splunk to try to parse out the structure. &amp;nbsp;But this is going to be messy and will never be robust. &amp;nbsp;Unless your developers swear on their descendants' descendants (and their ancestors' ancestors) not to change format, you future can be ruined at their whim.&lt;/P&gt;&lt;P&gt;Before I delve into SPL, I also want to clarify this: Splunk already give you the following fields:&amp;nbsp;&lt;SPAN&gt;channelCode, contentType, duration, eventNumber, eventTitle, events, onAir, system, type, and utcStartDateTime. &amp;nbsp;Is this correct? &amp;nbsp;While you can ignore any second level fields such as eventTitle and eventNumber, I also want to confirm that events includes the whole thing from [ all the way to ]. &amp;nbsp;Is this correct?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'll suggest two approaches, both rely on the structure I reverse engineered above. &amp;nbsp;The first one is straight string manipulation, and uses Splunk's split function to isolate individual events.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| fields system channelCode channelCode type events
| eval events = split(events, "),")
| mvexpand events
| rename events AS _raw
| rex mode=sed "s/^[\[\s]*Event\(// s/[\)\]]//g"
| kv kvdelim="=" pairdelim=","&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The second one tries to "translate" your developers's log structure into JSON using string manipulation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=events mode=sed "s/\(/\": {/g s/ *\)/}}/g s/=\s+/=/g s/\s+,/,/g s/(\w+)=([^,}]+)/\"\1\": \"\2\"/g s/\"(true|false)\"/\1/g s/Event/{\"Event/g"

| spath input=events path={}
| fields - events
| mvexpand {}
| spath input={}
| fields - {}
| rename Event.* As *&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The second approach is not more robust; if anything, it is less. &amp;nbsp;But it better illustrates the perceived structure.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Either way, your sample data should give you something like&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;channelCode&lt;/TD&gt;&lt;TD&gt;contentType&lt;/TD&gt;&lt;TD&gt;duration&lt;/TD&gt;&lt;TD&gt;eventNumber&lt;/TD&gt;&lt;TD&gt;eventTitle&lt;/TD&gt;&lt;TD&gt;onAir&lt;/TD&gt;&lt;TD&gt;system&lt;/TD&gt;&lt;TD&gt;type&lt;/TD&gt;&lt;TD&gt;utcStartDateTime&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;UH&lt;/TD&gt;&lt;TD&gt;Prog&lt;/TD&gt;&lt;TD&gt;00:00:05.000&lt;/TD&gt;&lt;TD&gt;725538339&lt;/TD&gt;&lt;TD&gt;BooRadley&lt;/TD&gt;&lt;TD&gt;true&lt;/TD&gt;&lt;TD&gt;GRP1-VIPE&lt;/TD&gt;&lt;TD&gt;NextEvents&lt;/TD&gt;&lt;TD&gt;2023-11-17T15:42:10.160Z&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;UH&lt;/TD&gt;&lt;TD&gt;Bumper&lt;/TD&gt;&lt;TD&gt;00:00:02.000&lt;/TD&gt;&lt;TD&gt;725538313&lt;/TD&gt;&lt;TD&gt;REGGAE-2&lt;/TD&gt;&lt;TD&gt;false&lt;/TD&gt;&lt;TD&gt;GRP1-VIPE&lt;/TD&gt;&lt;TD&gt;NextEvents&lt;/TD&gt;&lt;TD&gt;2023-11-17T15:42:15.160Z&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;UH&lt;/TD&gt;&lt;TD&gt;Commercial&lt;/TD&gt;&lt;TD&gt;00:01:30.000&lt;/TD&gt;&lt;TD&gt;725538320&lt;/TD&gt;&lt;TD&gt;CHRISITAN MISSION&lt;/TD&gt;&lt;TD&gt;false&lt;/TD&gt;&lt;TD&gt;GRP1-VIPE&lt;/TD&gt;&lt;TD&gt;NextEvents&lt;/TD&gt;&lt;TD&gt;2023-11-17T15:42:17.160Z&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;This is an emulation you can play with and compare with real data&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw = "20231117154211 [18080-exec-9] INFO EventConversionService () - SArts: VUpdate(system=GRP1-VIPE, channelCode=UH, type=NextEvents, events=[Event(onAir=true,  eventNumber=725538339, utcStartDateTime=2023-11-17T15:42:10.160Z, duration=00:00:05.000, eventTitle=BooRadley, contentType=Prog ), Event(onAir=false, eventNumber=725538313, utcStartDateTime=2023-11-17T15:42:15.160Z,  duration=00:00:02.000, eventTitle= REGGAE-2, contentType=Bumper), Event(onAir=false, eventNumber=725538320, utcStartDateTime=2023-11-17T15:42:17.160Z,  duration=00:01:30.000,  eventTitle=CHRISITAN MISSION , contentType=Commercial)])"
| extract
``` data emulation above ```&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2023 19:38:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Not-all-fields-in-log-line-extracted/m-p/669054#M229485</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-11-17T19:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: Not all fields in log line extracted</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Not-all-fields-in-log-line-extracted/m-p/669422#M229602</link>
      <description>&lt;P&gt;Hi Yuanlui,&lt;BR /&gt;&lt;BR /&gt;I dont think the devs will change the code!!!&lt;BR /&gt;&lt;BR /&gt;Thank you, option one seems to do the trick.&lt;BR /&gt;Its taken me a bit of time to work through the answer to try and understand it and i am still struggling with the sed magic, but will persevere.&lt;BR /&gt;thank you again.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 07:41:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Not-all-fields-in-log-line-extracted/m-p/669422#M229602</guid>
      <dc:creator>ssaenger</dc:creator>
      <dc:date>2023-11-22T07:41:28Z</dc:date>
    </item>
  </channel>
</rss>

