<?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 Regex Truncation vs Rex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-Truncation-vs-Rex/m-p/532451#M150421</link>
    <description>&lt;P&gt;Hi,&lt;BR /&gt;I searched and found several tickets regarding my situation, but all lead to nowhere.&amp;nbsp; So, my situation...&lt;/P&gt;&lt;P&gt;Unfortunately we have a few logs that mix formats eg starts in plain text and then contains a json payload.&amp;nbsp; The events are &amp;lt;4000 chars, so I can't see where the truncation is happening.&lt;/P&gt;&lt;P&gt;I've also tried specifying the following in props/transforms with no difference.:&lt;BR /&gt;TRUNCATE = 100000&lt;BR /&gt;MAXEVENTS = 500&lt;BR /&gt;MAXCHARS = 100000&lt;BR /&gt;DEPTH_LIMIT = 5000&lt;/P&gt;&lt;P&gt;I'm probably missing something obvious. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;My current props/transforms for this sourcetype are:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[opt:gateway]
KV_MODE = none
TIME_PREFIX = ^
TIME_FORMAT = %Y-%m-%d %H:%M:%S,%3N
SHOULD_LINEMERGE = true
BREAK_ONLY_BEFORE_DATE = true
TRANSFORMS-opt_json2 = optimus_dll1,optimus_dll2
SEDCMD-eol = s/\\r\\n//g
LINE_BREAKER=([\r\n]+)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;[optimus_dll1]
REGEX = ^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2},\d{3}\s+\[\S+\]\s+(?P&amp;lt;LogLevel&amp;gt;[^ ]\w+)\s+(?P&amp;lt;OptimusDLL&amp;gt;[^ ]+)
WRITE_META = true
REPEAT_MATCH = false
FORMAT = LogLevel::$1 OptimusDLL::$2

[optimus_dll2]
REGEX = ^(?:[^$]*)\s-\s(?P&amp;lt;json&amp;gt;.+)
FORMAT = json::$1
WRITE_META = true
REPEAT_MATCH = false
SOURCE_KEY = _raw
DEPTH_LIMIT = 5000&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;optimus_dll1 is extracted as expected, optimus_dll2 only grabs the first 1000 chars of the match.&lt;/P&gt;&lt;P&gt;Using the regex inline via rex, via regex101 or cmdline all extract the full field.&lt;/P&gt;&lt;P&gt;TIA&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;</description>
    <pubDate>Wed, 06 Jan 2021 10:12:54 GMT</pubDate>
    <dc:creator>cdstealer</dc:creator>
    <dc:date>2021-01-06T10:12:54Z</dc:date>
    <item>
      <title>Regex Truncation vs Rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Truncation-vs-Rex/m-p/532451#M150421</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;I searched and found several tickets regarding my situation, but all lead to nowhere.&amp;nbsp; So, my situation...&lt;/P&gt;&lt;P&gt;Unfortunately we have a few logs that mix formats eg starts in plain text and then contains a json payload.&amp;nbsp; The events are &amp;lt;4000 chars, so I can't see where the truncation is happening.&lt;/P&gt;&lt;P&gt;I've also tried specifying the following in props/transforms with no difference.:&lt;BR /&gt;TRUNCATE = 100000&lt;BR /&gt;MAXEVENTS = 500&lt;BR /&gt;MAXCHARS = 100000&lt;BR /&gt;DEPTH_LIMIT = 5000&lt;/P&gt;&lt;P&gt;I'm probably missing something obvious. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;My current props/transforms for this sourcetype are:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[opt:gateway]
KV_MODE = none
TIME_PREFIX = ^
TIME_FORMAT = %Y-%m-%d %H:%M:%S,%3N
SHOULD_LINEMERGE = true
BREAK_ONLY_BEFORE_DATE = true
TRANSFORMS-opt_json2 = optimus_dll1,optimus_dll2
SEDCMD-eol = s/\\r\\n//g
LINE_BREAKER=([\r\n]+)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;[optimus_dll1]
REGEX = ^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2},\d{3}\s+\[\S+\]\s+(?P&amp;lt;LogLevel&amp;gt;[^ ]\w+)\s+(?P&amp;lt;OptimusDLL&amp;gt;[^ ]+)
WRITE_META = true
REPEAT_MATCH = false
FORMAT = LogLevel::$1 OptimusDLL::$2

[optimus_dll2]
REGEX = ^(?:[^$]*)\s-\s(?P&amp;lt;json&amp;gt;.+)
FORMAT = json::$1
WRITE_META = true
REPEAT_MATCH = false
SOURCE_KEY = _raw
DEPTH_LIMIT = 5000&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;optimus_dll1 is extracted as expected, optimus_dll2 only grabs the first 1000 chars of the match.&lt;/P&gt;&lt;P&gt;Using the regex inline via rex, via regex101 or cmdline all extract the full field.&lt;/P&gt;&lt;P&gt;TIA&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 10:12:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Truncation-vs-Rex/m-p/532451#M150421</guid>
      <dc:creator>cdstealer</dc:creator>
      <dc:date>2021-01-06T10:12:54Z</dc:date>
    </item>
  </channel>
</rss>

