<?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 Extract field in indexing time in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Extract-field-in-indexing-time/m-p/712006#M117586</link>
    <description>&lt;P&gt;I want to extract value from the following field while indexing the data to use it to map it with index.&lt;/P&gt;&lt;P&gt;vs_name=v-jupiter-prd-cbc-us.sony-443-ipv6&lt;/P&gt;&lt;P&gt;I want to extract every field after v- and till sony. I.e., jupiter-prd-cbc-us.sony as fqdn so that this fqdn will check in lookup to map it to correct index.&lt;/P&gt;&lt;P&gt;Please help me with props and transforms to extract fqdn correctly.&lt;/P&gt;</description>
    <pubDate>Wed, 19 Feb 2025 15:23:38 GMT</pubDate>
    <dc:creator>splunklearner</dc:creator>
    <dc:date>2025-02-19T15:23:38Z</dc:date>
    <item>
      <title>Extract field in indexing time</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extract-field-in-indexing-time/m-p/712006#M117586</link>
      <description>&lt;P&gt;I want to extract value from the following field while indexing the data to use it to map it with index.&lt;/P&gt;&lt;P&gt;vs_name=v-jupiter-prd-cbc-us.sony-443-ipv6&lt;/P&gt;&lt;P&gt;I want to extract every field after v- and till sony. I.e., jupiter-prd-cbc-us.sony as fqdn so that this fqdn will check in lookup to map it to correct index.&lt;/P&gt;&lt;P&gt;Please help me with props and transforms to extract fqdn correctly.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2025 15:23:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extract-field-in-indexing-time/m-p/712006#M117586</guid>
      <dc:creator>splunklearner</dc:creator>
      <dc:date>2025-02-19T15:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: Extract field in indexing time</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extract-field-in-indexing-time/m-p/712010#M117587</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/273723"&gt;@splunklearner&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is quite complex to achieve in props/transforms but shouldnt be impossible - lets have a go..&lt;/P&gt;&lt;P&gt;This is what it would look like as SPL - use this to tweak your eval to match your field names and config, then apply to the transforms as below.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval _raw="something=v-jupiter-prd-cbc-us.sony-443-ipv6"
| eval hostType=replace(_raw, ".*v\-(?&amp;lt;hostType&amp;gt;[^\.]+)\.sony.*", "\1")
| eval yourIndex=json_extract(lookup("testlookup.csv",json_object("hostType",hostType), json_array(index)),"index")
``` as one line ```
| eval yourIndexNew=json_extract(lookup("testlookup.csv",json_object("hostType",replace(_raw, ".*v\-(?&amp;lt;hostType&amp;gt;[^\.]+)\.sony.*", "\1")), json_array(index)),"index")&lt;/LI-CODE&gt;&lt;P&gt;You will also need a lookup in $SPLUNK_HOME/system/lookups - in this example its testlookup.csv. For the purposes of testing in SPL you can create a temporary lookup with this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval hostType="jupiter-prd-cbc-us", index="index1" 
| outputlookup testlookup.csv&lt;/LI-CODE&gt;&lt;P&gt;Props/transforms.conf&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;== props.conf ==
[yourSourcetype]
TRANSFORMS-defineIndex = defineIndex

== transforms.conf ==
[defineIndex]
INGEST_EVAL = index=json_extract(lookup("testlookup.csv",json_object("hostType",replace(_raw, ".*v\-(?&amp;lt;hostType&amp;gt;[^\.]+)\.sony.*", "\1")), json_array(index)),"index")&lt;/LI-CODE&gt;&lt;P&gt;For more info on how the lookup command works, have a look at&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/9.4.0/SearchReference/ConditionalFunctions#lookup.28.26lt.3Blookup_table.26gt.3B.2C.26lt.3Bjson_object.26gt.3B.2C.26lt.3Bjson_array.26gt.3B.29" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/9.4.0/SearchReference/ConditionalFunctions#lookup.28.26lt.3Blookup_table.26gt.3B.2C.26lt.3Bjson_object.26gt.3B.2C.26lt.3Bjson_array.26gt.3B.29&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Please let me know how you get on and consider accepting this answer or adding karma this answer if it has helped.&lt;BR /&gt;Regards&lt;/P&gt;&lt;P&gt;Will&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2025 15:50:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extract-field-in-indexing-time/m-p/712010#M117587</guid>
      <dc:creator>livehybrid</dc:creator>
      <dc:date>2025-02-19T15:50:09Z</dc:date>
    </item>
    <item>
      <title>Re: Extract field in indexing time</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extract-field-in-indexing-time/m-p/712012#M117588</link>
      <description>&lt;P&gt;I already have ingest eval in place. I only need to extract fqdn from vs_name in order to match there.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2025 16:08:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extract-field-in-indexing-time/m-p/712012#M117588</guid>
      <dc:creator>splunklearner</dc:creator>
      <dc:date>2025-02-19T16:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: Extract field in indexing time</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extract-field-in-indexing-time/m-p/712034#M117591</link>
      <description>&lt;P&gt;You would therefore use "&lt;SPAN&gt;vs_name" in-place of "_raw" in the replace command.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You can use multiple transforms on a single sourcetype - even if you're already using an INGEST_EVAL.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;For example&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;== props.conf ==
[yourSourcetype]
TRANSFORMS-defineIndex =.defineIndex
TRANSFORMS-extractServerId =.extractServerId
... etc ...&lt;/LI-CODE&gt;&lt;P&gt;Please let me know how you get on and consider accepting this answer or adding karma this answer if it has helped.&lt;BR /&gt;Regards&lt;/P&gt;&lt;P&gt;Will&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2025 20:59:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extract-field-in-indexing-time/m-p/712034#M117591</guid>
      <dc:creator>livehybrid</dc:creator>
      <dc:date>2025-02-19T20:59:44Z</dc:date>
    </item>
  </channel>
</rss>

