<?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 do I override field extraction from json? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-override-field-extraction-from-json/m-p/589661#M103387</link>
    <description>&lt;P&gt;No, sedcmd doesn't have anything to do with it.&lt;/P&gt;&lt;P&gt;Remember that sedcmd is a transform applied at ingest time whereas kv_mode works in search-time.&lt;/P&gt;&lt;P&gt;Unfortunately, the order of search-time operations together with the possible address formats makes the task tricky. &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Searchtimeoperationssequence" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Searchtimeoperationssequence&lt;/A&gt;&lt;/P&gt;&lt;P&gt;It'd be relatively easy to create a calculated field to split your recipient field into separate values on comma.&lt;/P&gt;&lt;P&gt;The problem is that you would get all the recipient data, not just email address.&lt;/P&gt;&lt;P&gt;Unfortunately, you can't perform any more modifications on the calculated fields and separate calculated fields are performed in parallel so they are not "chainable".&lt;/P&gt;&lt;P&gt;So your task is relatively complicated because you have many possible formats of data in your recipient field.&lt;/P&gt;&lt;P&gt;You could do a regex-based extraction on the raw field (not parsing it as json) but it's tricky especially if your event can be multiline.&lt;/P&gt;&lt;P&gt;You could try to "normalize" the format of the ingested data on ingest time but it's also a bit complicated since SEDcmd is relatively simple in its funcitonality whereas you need a decent level of format validation.&lt;/P&gt;&lt;P&gt;It's of course all extractable by performing a proper search but that's not what you want if you want to normalize the fields for datamodel.&lt;/P&gt;&lt;P&gt;It's a relatively tricky task and requires some careful development and checking your border cases. It might be worth consulting your splunk partner or professional services for this one.&lt;/P&gt;</description>
    <pubDate>Fri, 18 Mar 2022 10:11:57 GMT</pubDate>
    <dc:creator>PickleRick</dc:creator>
    <dc:date>2022-03-18T10:11:57Z</dc:date>
    <item>
      <title>How do I override field extraction from json?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-override-field-extraction-from-json/m-p/589404#M103365</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I send email data to http event collector in JSON format like this :&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{
"sender-domain":"domain.com",
"sender":"sender.test@domain.com",
"recipient":"Name1 Surname1&amp;lt;name1.surname1@domain.com&amp;gt;, "Name2 Surname2&amp;lt;name2.surname2@domain.com&amp;gt;"
}&lt;/LI-CODE&gt;
&lt;P&gt;I would like to extract email addresses from recipient field and save it as multivalue field with the same name (field recipient will be used in email data model).&lt;/P&gt;
&lt;P&gt;Do you have any idea what can i do this?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The only idea which I have is use sedcmd to change name for recipient&amp;nbsp; to another field name and next use regex to do extraction from this fields email adresses as recipient field.&lt;/P&gt;
&lt;P&gt;The Regex is:&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;SOURCE_KEY = changed_recipient_field_name
REGEX = (?&amp;lt;recipient&amp;gt;[\w\d\.\-\=\+]+\@[\w\d\.\-]+)
FORMAT = recipient::$1&lt;/LI-CODE&gt;
&lt;P&gt;What is the best solution for this?&lt;/P&gt;
&lt;P&gt;Thank you in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2022 20:26:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-override-field-extraction-from-json/m-p/589404#M103365</guid>
      <dc:creator>mk1294splunk</dc:creator>
      <dc:date>2022-03-16T20:26:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do I override field extraction from json?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-override-field-extraction-from-json/m-p/589406#M103366</link>
      <description>&lt;P&gt;Firstly, that's not a well-formed json structure.&lt;/P&gt;&lt;P&gt;Secondly - why do you want to _change_ the field name? You can&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2022 20:39:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-override-field-extraction-from-json/m-p/589406#M103366</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-03-16T20:39:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do I override field extraction from json?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-override-field-extraction-from-json/m-p/589584#M103383</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have configured KV_MODE=json and&amp;nbsp; automatically extraction all fields.&lt;/P&gt;&lt;P&gt;Currently the value of field recipient is:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Name1 Surname1&amp;lt;name1.surname1@domain.com&amp;gt;, "Name2 Surname2&amp;lt;name2.surname2@domain.com&amp;gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I would like to have multivalue field recipient with following values (Field recipient is used by the Email Data Model):&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;A href="mailto:name1.surname1@domain.com" target="_blank"&gt;name1.surname1@domain.com&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;A href="mailto:name2.surname2@domain.com" target="_blank"&gt;name2.surname2@domain.com&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;It is possible to override field value?&lt;/P&gt;&lt;P&gt;If i change the field name to another with sedcmd I can extract email addresses value with regex and create recipient field as I want.&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the best solution for this? Create own extraction(Not use json mode)?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2022 20:21:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-override-field-extraction-from-json/m-p/589584#M103383</guid>
      <dc:creator>mk1294splunk</dc:creator>
      <dc:date>2022-03-17T20:21:46Z</dc:date>
    </item>
    <item>
      <title>Re: How do I override field extraction from json?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-override-field-extraction-from-json/m-p/589661#M103387</link>
      <description>&lt;P&gt;No, sedcmd doesn't have anything to do with it.&lt;/P&gt;&lt;P&gt;Remember that sedcmd is a transform applied at ingest time whereas kv_mode works in search-time.&lt;/P&gt;&lt;P&gt;Unfortunately, the order of search-time operations together with the possible address formats makes the task tricky. &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Searchtimeoperationssequence" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Searchtimeoperationssequence&lt;/A&gt;&lt;/P&gt;&lt;P&gt;It'd be relatively easy to create a calculated field to split your recipient field into separate values on comma.&lt;/P&gt;&lt;P&gt;The problem is that you would get all the recipient data, not just email address.&lt;/P&gt;&lt;P&gt;Unfortunately, you can't perform any more modifications on the calculated fields and separate calculated fields are performed in parallel so they are not "chainable".&lt;/P&gt;&lt;P&gt;So your task is relatively complicated because you have many possible formats of data in your recipient field.&lt;/P&gt;&lt;P&gt;You could do a regex-based extraction on the raw field (not parsing it as json) but it's tricky especially if your event can be multiline.&lt;/P&gt;&lt;P&gt;You could try to "normalize" the format of the ingested data on ingest time but it's also a bit complicated since SEDcmd is relatively simple in its funcitonality whereas you need a decent level of format validation.&lt;/P&gt;&lt;P&gt;It's of course all extractable by performing a proper search but that's not what you want if you want to normalize the fields for datamodel.&lt;/P&gt;&lt;P&gt;It's a relatively tricky task and requires some careful development and checking your border cases. It might be worth consulting your splunk partner or professional services for this one.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2022 10:11:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-override-field-extraction-from-json/m-p/589661#M103387</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-03-18T10:11:57Z</dc:date>
    </item>
  </channel>
</rss>

