<?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 Filter a log using regex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Filter-a-log-using-regex/m-p/691004#M235336</link>
    <description>&lt;P&gt;&lt;SPAN&gt;I need to filter a part of a log using regex, I have the following log&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;log:&amp;nbsp;{dx.trace_id=xxxxx, dx.span_id=yyyyy, dx.trace_sampled=true}&lt;/SPAN&gt;{"logtopic":"x","appname":"y","module":"z","Id":"asdasd","traceId":"aaaaaaa","parentId":"sssssss","spanId":"ddddddd","traceFlags":"00","timestamp":"2024-05-29 11:42:37.675","event":"POST:geAll","level":"info","payload":{"orderId":"yyyy","channel":"zzz","skupCheck":true},"msgResponse":{"httpMethod":"POST","httpStatusCode":200,"httpMessage":"OK","url":"getAll"},"message":"Response in POST:getAll"}&lt;/P&gt;&lt;P&gt;I need to remove this fragment from the answer&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;{dx.trace_id=xxxxx, dx.span_id=yyyyy, dx.trace_sampled=true}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;so that the visible log is the following&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;log:&amp;nbsp;{"logtopic":"x","appname":"y","module":"z","Id":"asdasd","traceId":"aaaaaaa","parentId":"sssssss","spanId":"ddddddd","traceFlags":"00","timestamp":"2024-05-29 11:42:37.675","event":"POST:geAll","level":"info","payload":{"orderId":"yyyy","channel":"zzz","skupCheck":true},"msgResponse":{"httpMethod":"POST","httpStatusCode":200,"httpMessage":"OK","url":"getAll"},"message":"Response in POST:getAll"}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;There are also outputs where what I need to filter is presented with fewer fields or without fields, leaving it this way&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;log:&amp;nbsp;{dx.trace_sampled=true}{"logtopic":"x","appname":"y","module":"z","Id":"asdasd","traceId":"aaaaaaa","parentId":"sssssss","spanId":"ddddddd","traceFlags":"00","timestamp":"2024-05-29 11:42:37.675","event":"POST:geAll","level":"info","payload":{"orderId":"yyyy","channel":"zzz","skupCheck":true},"msgResponse":{"httpMethod":"POST","httpStatusCode":200,"httpMessage":"OK","url":"getAll"},"message":"Response in POST:getAll"}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;log:&amp;nbsp;{}&lt;/SPAN&gt;{"logtopic":"x","appname":"y","module":"z","Id":"asdasd","traceId":"aaaaaaa","parentId":"sssssss","spanId":"ddddddd","traceFlags":"00","timestamp":"2024-05-29 11:42:37.675","event":"POST:geAll","level":"info","payload":{"orderId":"yyyy","channel":"zzz","skupCheck":true},"msgResponse":{"httpMethod":"POST","httpStatusCode":200,"httpMessage":"OK","url":"getAll"},"message":"Response in POST:getAll"}&lt;/P&gt;&lt;P&gt;In these last two examples I still need to filter the following respectively&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;{dx.trace_sampled=true}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;{}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So that the output is finally clean and leaves only what I need&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;log:&amp;nbsp;{"logtopic":"x","appname":"y","module":"z","Id":"asdasd","traceId":"aaaaaaa","parentId":"sssssss","spanId":"ddddddd","traceFlags":"00","timestamp":"2024-05-29 11:42:37.675","event":"POST:geAll","level":"info","payload":{"orderId":"yyyy","channel":"zzz","skupCheck":true},"msgResponse":{"httpMethod":"POST","httpStatusCode":200,"httpMessage":"OK","url":"getAll"},"message":"Response in POST:getAll"}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I hope you can help me please&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 18 Jun 2024 14:26:04 GMT</pubDate>
    <dc:creator>jose_sepulveda</dc:creator>
    <dc:date>2024-06-18T14:26:04Z</dc:date>
    <item>
      <title>Filter a log using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-a-log-using-regex/m-p/691004#M235336</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I need to filter a part of a log using regex, I have the following log&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;log:&amp;nbsp;{dx.trace_id=xxxxx, dx.span_id=yyyyy, dx.trace_sampled=true}&lt;/SPAN&gt;{"logtopic":"x","appname":"y","module":"z","Id":"asdasd","traceId":"aaaaaaa","parentId":"sssssss","spanId":"ddddddd","traceFlags":"00","timestamp":"2024-05-29 11:42:37.675","event":"POST:geAll","level":"info","payload":{"orderId":"yyyy","channel":"zzz","skupCheck":true},"msgResponse":{"httpMethod":"POST","httpStatusCode":200,"httpMessage":"OK","url":"getAll"},"message":"Response in POST:getAll"}&lt;/P&gt;&lt;P&gt;I need to remove this fragment from the answer&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;{dx.trace_id=xxxxx, dx.span_id=yyyyy, dx.trace_sampled=true}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;so that the visible log is the following&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;log:&amp;nbsp;{"logtopic":"x","appname":"y","module":"z","Id":"asdasd","traceId":"aaaaaaa","parentId":"sssssss","spanId":"ddddddd","traceFlags":"00","timestamp":"2024-05-29 11:42:37.675","event":"POST:geAll","level":"info","payload":{"orderId":"yyyy","channel":"zzz","skupCheck":true},"msgResponse":{"httpMethod":"POST","httpStatusCode":200,"httpMessage":"OK","url":"getAll"},"message":"Response in POST:getAll"}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;There are also outputs where what I need to filter is presented with fewer fields or without fields, leaving it this way&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;log:&amp;nbsp;{dx.trace_sampled=true}{"logtopic":"x","appname":"y","module":"z","Id":"asdasd","traceId":"aaaaaaa","parentId":"sssssss","spanId":"ddddddd","traceFlags":"00","timestamp":"2024-05-29 11:42:37.675","event":"POST:geAll","level":"info","payload":{"orderId":"yyyy","channel":"zzz","skupCheck":true},"msgResponse":{"httpMethod":"POST","httpStatusCode":200,"httpMessage":"OK","url":"getAll"},"message":"Response in POST:getAll"}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;log:&amp;nbsp;{}&lt;/SPAN&gt;{"logtopic":"x","appname":"y","module":"z","Id":"asdasd","traceId":"aaaaaaa","parentId":"sssssss","spanId":"ddddddd","traceFlags":"00","timestamp":"2024-05-29 11:42:37.675","event":"POST:geAll","level":"info","payload":{"orderId":"yyyy","channel":"zzz","skupCheck":true},"msgResponse":{"httpMethod":"POST","httpStatusCode":200,"httpMessage":"OK","url":"getAll"},"message":"Response in POST:getAll"}&lt;/P&gt;&lt;P&gt;In these last two examples I still need to filter the following respectively&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;{dx.trace_sampled=true}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;{}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So that the output is finally clean and leaves only what I need&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;log:&amp;nbsp;{"logtopic":"x","appname":"y","module":"z","Id":"asdasd","traceId":"aaaaaaa","parentId":"sssssss","spanId":"ddddddd","traceFlags":"00","timestamp":"2024-05-29 11:42:37.675","event":"POST:geAll","level":"info","payload":{"orderId":"yyyy","channel":"zzz","skupCheck":true},"msgResponse":{"httpMethod":"POST","httpStatusCode":200,"httpMessage":"OK","url":"getAll"},"message":"Response in POST:getAll"}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I hope you can help me please&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 14:26:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-a-log-using-regex/m-p/691004#M235336</guid>
      <dc:creator>jose_sepulveda</dc:creator>
      <dc:date>2024-06-18T14:26:04Z</dc:date>
    </item>
    <item>
      <title>Re: Filter a log using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-a-log-using-regex/m-p/691006#M235337</link>
      <description>&lt;LI-CODE lang="markup"&gt;| rex mode=sed "s/log: {[^}]*}/log: {}/g"&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 18 Jun 2024 14:48:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-a-log-using-regex/m-p/691006#M235337</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-06-18T14:48:09Z</dc:date>
    </item>
    <item>
      <title>Re: Filter a log using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-a-log-using-regex/m-p/691007#M235338</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/269143"&gt;@jose_sepulveda&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;at first: do you want to remove a part of your logs before indexing or at search time?&lt;/P&gt;&lt;P&gt;if at index time remember that in this way you change the format of your logs, so the add-ons could not work correctly!&lt;/P&gt;&lt;P&gt;anyway, why do you want to remove a part of your logs?&lt;/P&gt;&lt;P&gt;your request doesn't seem to be an obfuscation.&lt;/P&gt;&lt;P&gt;anyway, you can do this using the command SEDCMD in the props.con using a substitution regex like the following:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SEDCMD = s/([^\}]+\})(.*)/$2/g&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 14:48:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-a-log-using-regex/m-p/691007#M235338</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-06-18T14:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: Filter a log using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-a-log-using-regex/m-p/691014#M235339</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a service developed in JAVA that is dockerized, a shared tomcat image is used that is adding these fragments to the service's output logs, which are the ones I really need to view in splunk. For this reason the response is no longer a valid Json and the visualization is presented as a string and I need to resolve that situation&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 15:06:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-a-log-using-regex/m-p/691014#M235339</guid>
      <dc:creator>jose_sepulveda</dc:creator>
      <dc:date>2024-06-18T15:06:29Z</dc:date>
    </item>
    <item>
      <title>Re: Filter a log using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-a-log-using-regex/m-p/691015#M235340</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/269143"&gt;@jose_sepulveda&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;ok, please, check my solution or the one from&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;that's similar.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 15:11:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-a-log-using-regex/m-p/691015#M235340</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-06-18T15:11:21Z</dc:date>
    </item>
    <item>
      <title>Re: Filter a log using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-a-log-using-regex/m-p/691019#M235341</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;When adding the regular expression indicated by&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp; to the search, it still appears in the result, which I need to remove&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Captura de pantalla 2024-06-18 a la(s) 11.18.31 a.&amp;nbsp;m..png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/31366iAE136C56ACCC8150/image-size/large?v=v2&amp;amp;px=999" role="button" title="Captura de pantalla 2024-06-18 a la(s) 11.18.31 a.&amp;nbsp;m..png" alt="Captura de pantalla 2024-06-18 a la(s) 11.18.31 a.&amp;nbsp;m..png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 15:26:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-a-log-using-regex/m-p/691019#M235341</guid>
      <dc:creator>jose_sepulveda</dc:creator>
      <dc:date>2024-06-18T15:26:36Z</dc:date>
    </item>
    <item>
      <title>Re: Filter a log using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-a-log-using-regex/m-p/691029#M235347</link>
      <description>&lt;P&gt;This looks like a corrupted / non-standard version of JSON (It would be helpful for you to share the unformatted version of the log since that is what the rex will be working with!). Try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex mode=sed "s/\"log\": {[^}]*}/\"log\": {}/g"&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 18 Jun 2024 17:35:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-a-log-using-regex/m-p/691029#M235347</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-06-18T17:35:40Z</dc:date>
    </item>
  </channel>
</rss>

