<?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 remove json key value pairs from events log data in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-json-key-value-pairs-from-events-log-data/m-p/632501#M219716</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/254255"&gt;@ayushram&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;you can avoid to display a part of your logs in your searches, but accessing the raw log it's all visible:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex mode=sed "s/(?ms)\"toBeRemoved\":.*\}\],//g"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Feb 2023 07:37:52 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2023-02-28T07:37:52Z</dc:date>
    <item>
      <title>How to remove json key value pairs from events log data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-json-key-value-pairs-from-events-log-data/m-p/632329#M219650</link>
      <description>&lt;P&gt;Splunk search events returns json format log data. I want to remove a particular key:value pair since the value of this key is huge (in terms of length) and unnecessary. How can I do so.&lt;BR /&gt;&lt;BR /&gt;sample log data:&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;"abcd1": "asd",&lt;BR /&gt;"abcd2": [],&lt;BR /&gt;"abcd3": true,&lt;BR /&gt;&lt;STRONG&gt;"toBeRemoved": [{&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;"abcd8": 234,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;"abcd9": [{&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;"abcd10": "asd234"&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;}],&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;"abcd11": "asdasd"&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;}]&lt;/STRONG&gt;,&lt;BR /&gt;"abcd4": 324.234,&lt;BR /&gt;"abcd5": "dfsad dfsdf",&lt;BR /&gt;"abcd6": 0,&lt;BR /&gt;"abcd7": "asfsdf"&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;The key:value pair to be removed has been marked in bold.&lt;/P&gt;&lt;P&gt;! NOTE THIS IS FORMATTED DATA, FIELDS CAN HAVE STRINGS, NUMBERS, BOTH, LISTS, ETC !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2023 08:07:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-json-key-value-pairs-from-events-log-data/m-p/632329#M219650</guid>
      <dc:creator>ayushram</dc:creator>
      <dc:date>2023-02-27T08:07:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove json key value pairs from events log data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-json-key-value-pairs-from-events-log-data/m-p/632330#M219651</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/254255"&gt;@ayushram&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;if you want to remove the highlighted data from the logs before indexing you have to add to your props.conf:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[your_sourcetype]
SEDCMD = s/(?ms)\"toBeRemoved\":.*\}\],//g&lt;/LI-CODE&gt;&lt;P&gt;remember that this props.conf must be added on your Indexers or (if present) on your Heavy Forwarders.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2023 08:20:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-json-key-value-pairs-from-events-log-data/m-p/632330#M219651</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-02-27T08:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove json key value pairs from events log data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-json-key-value-pairs-from-events-log-data/m-p/632332#M219652</link>
      <description>&lt;P&gt;I do not have access to pros.conf&lt;BR /&gt;&lt;BR /&gt;Is there any way to do this from search itself?&lt;BR /&gt;I want my final data in " | table ", but it's not loading wherever this highlighted field appears (since it has too many characters)&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2023 08:47:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-json-key-value-pairs-from-events-log-data/m-p/632332#M219652</guid>
      <dc:creator>ayushram</dc:creator>
      <dc:date>2023-02-27T08:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove json key value pairs from events log data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-json-key-value-pairs-from-events-log-data/m-p/632341#M219663</link>
      <description>&lt;P&gt;Try something like this - this assumes "toBeRemove" is not the first element i.e. is is preceded by a comma (which needs to be removed).&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex mode=sed "s/(?ms),\s*\"toBeRemoved\":\s*\[([^\[\]]+|\[[^\]]*\])*\]//g"&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 27 Feb 2023 10:36:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-json-key-value-pairs-from-events-log-data/m-p/632341#M219663</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-02-27T10:36:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove json key value pairs from events log data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-json-key-value-pairs-from-events-log-data/m-p/632501#M219716</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/254255"&gt;@ayushram&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;you can avoid to display a part of your logs in your searches, but accessing the raw log it's all visible:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex mode=sed "s/(?ms)\"toBeRemoved\":.*\}\],//g"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 07:37:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-json-key-value-pairs-from-events-log-data/m-p/632501#M219716</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-02-28T07:37:52Z</dc:date>
    </item>
  </channel>
</rss>

