<?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 write regex to filter events in JSON format? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-regex-to-filter-events-in-JSON-format/m-p/262487#M175823</link>
    <description>&lt;P&gt;Hi Cusello,&lt;/P&gt;

&lt;P&gt;Thanks for your reguler expression. I think their is confusion I want to send this kind of events to nullQueue for which I required REGEX stanza to be add into transforms.conf.&lt;/P&gt;</description>
    <pubDate>Fri, 27 Jan 2017 13:24:04 GMT</pubDate>
    <dc:creator>p_gurav</dc:creator>
    <dc:date>2017-01-27T13:24:04Z</dc:date>
    <item>
      <title>How to write regex to filter events in JSON format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-regex-to-filter-events-in-JSON-format/m-p/262485#M175821</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
Kindly help me with this issue:&lt;/P&gt;

&lt;P&gt;{"sim-slot":"0","terminal-vendor":"Vendor","default-sms-app":"own","screen-orientation":"portrait","response-code":"200","secondary-device-type":"","international":"0","subject-region":"Lat=0,Lon=0,Alt=0,Acc=0","locale":"en_US","timestamp":"2017-01-19T13:24:22.986+00:00","user-agent":"IM-client/OMA1.0 model/brand-5.1 RCSAndrd/0.0.0 COMLib/0.00.00.rev00000","evt-client-version":"0.0.0","active-cs-call":"no","sbc-ip":"99.99.9.999:9999","transaction-id":"9aa99a9a-9aa9-99a9-a999-a9a9a999aa00","init-service-tag":"audiocall","description":"call-sip-invite-parent","call-id":"ZZZZZZZZZZZ","app-state":"foreground","module":"cs","terminal-sw-version":"0.0","imsi":"99999999999","remote-peer":"+99999999999","cell-id":"99999","platform":"phone-android","client-version":"3.10.32.rev74692","direction":"outgoing","network-bearer":"CELLULAR_LTE","terminal-model":"Model","sim":"mcc(000),mnc(000)","result":"success","identity":"+999999999999","device-id":"imei(9999999999),tac(99999)"}&lt;/P&gt;

&lt;P&gt;This is my sample log and i need to filter out events having specifically description:call-sip-invite-parent AND response-code:200.&lt;BR /&gt;
Events having response-code other than 200 for description:call-sip-invite-parent should be indexed.Kindly help with the regex&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:36:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-regex-to-filter-events-in-JSON-format/m-p/262485#M175821</guid>
      <dc:creator>p_gurav</dc:creator>
      <dc:date>2020-09-29T12:36:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to write regex to filter events in JSON format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-regex-to-filter-events-in-JSON-format/m-p/262486#M175822</link>
      <description>&lt;P&gt;Hi p_gurav,&lt;BR /&gt;
this the regex to extract your two fields.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\"response-code\":\"(?&amp;lt;responsecode&amp;gt;[^\"]*)\".*\"description\":\"(?&amp;lt;description&amp;gt;[^\"]*)\"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;you can test it at &lt;A href="https://regex101.com/r/3RcXn1/1"&gt;https://regex101.com/r/3RcXn1/1&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jan 2017 13:08:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-regex-to-filter-events-in-JSON-format/m-p/262486#M175822</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-01-27T13:08:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to write regex to filter events in JSON format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-regex-to-filter-events-in-JSON-format/m-p/262487#M175823</link>
      <description>&lt;P&gt;Hi Cusello,&lt;/P&gt;

&lt;P&gt;Thanks for your reguler expression. I think their is confusion I want to send this kind of events to nullQueue for which I required REGEX stanza to be add into transforms.conf.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jan 2017 13:24:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-regex-to-filter-events-in-JSON-format/m-p/262487#M175823</guid>
      <dc:creator>p_gurav</dc:creator>
      <dc:date>2017-01-27T13:24:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to write regex to filter events in JSON format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-regex-to-filter-events-in-JSON-format/m-p/262488#M175824</link>
      <description>&lt;P&gt;Ok no problem,&lt;BR /&gt;
try this regex&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\"response-code\":\"200\".*\"description\":\"call-sip-invite-parent\"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;before you can test it in Splunk using regex command and if it's Ok put in transforms.conf.&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jan 2017 13:36:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-regex-to-filter-events-in-JSON-format/m-p/262488#M175824</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-01-27T13:36:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to write regex to filter events in JSON format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-regex-to-filter-events-in-JSON-format/m-p/262489#M175825</link>
      <description>&lt;P&gt;Like this (on our indexers):&lt;/P&gt;

&lt;P&gt;props.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[YourSourcetypeHere]
TRANSFORMS-t1=eliminate-RC200-and-CSIP
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[eliminate-RC200-and-CSIP]
REGEX = (?ms)\"response-code\":\"200\".*\"description\":\"call-sip-invite-parent\"
DEST_KEY = queue
FORMAT = nullQueue
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bounce splunkd on each indexer and all future events to be indexed will be filtered.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Mar 2017 06:05:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-regex-to-filter-events-in-JSON-format/m-p/262489#M175825</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-03-05T06:05:06Z</dc:date>
    </item>
  </channel>
</rss>

