<?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: Add a static field during indexing in Deployment Architecture</title>
    <link>https://community.splunk.com/t5/Deployment-Architecture/Add-a-static-field-during-indexing/m-p/219423#M23769</link>
    <description>&lt;P&gt;There is no info on the time (7:30) within those names. To extract the date, you could use this regex&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?&amp;lt;year_sla&amp;gt;\d{4})_BWA_SHADOW_EXTRACT_MC_CCP_VM_ASOF_(?&amp;lt;month_sla&amp;gt;\w{3})(?&amp;lt;day_sla&amp;gt;\d+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to extract to individual fields for the first set and&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?&amp;lt;year_sla&amp;gt;\d{4})_Source_To_Source_Exception_Report_(?&amp;lt;month_sla&amp;gt;\w{3})(?&amp;lt;day_sla&amp;gt;\d+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;for the second - see the idea?&lt;/P&gt;</description>
    <pubDate>Thu, 05 Nov 2015 14:38:44 GMT</pubDate>
    <dc:creator>jeffland</dc:creator>
    <dc:date>2015-11-05T14:38:44Z</dc:date>
    <item>
      <title>Add a static field during indexing</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Add-a-static-field-during-indexing/m-p/219418#M23764</link>
      <description>&lt;P&gt;Hi All,,&lt;/P&gt;

&lt;P&gt;Want to add a static field called &lt;STRONG&gt;SLAtime&lt;/STRONG&gt; for each filename pattern range which is present in a existing filed called &lt;STRONG&gt;FileName&lt;/STRONG&gt;.&lt;BR /&gt;
Example below,&lt;/P&gt;

&lt;P&gt;FileName&lt;BR /&gt;
&lt;EM&gt;filename1&lt;/EM&gt;.log&lt;BR /&gt;
&lt;EM&gt;filename2&lt;/EM&gt;.log&lt;/P&gt;

&lt;P&gt;For these pattern want to add corresponding SLA field below while indexing.&lt;/P&gt;

&lt;P&gt;SLATime&lt;BR /&gt;
10:30 AM&lt;BR /&gt;
11:00 PM&lt;/P&gt;

&lt;P&gt;Could you help me to do these without input lookups ?&lt;BR /&gt;
Can this be done via field lookups ?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Prem&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2015 10:13:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Add-a-static-field-during-indexing/m-p/219418#M23764</guid>
      <dc:creator>xbbj3nj</dc:creator>
      <dc:date>2015-11-05T10:13:55Z</dc:date>
    </item>
    <item>
      <title>Re: Add a static field during indexing</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Add-a-static-field-during-indexing/m-p/219419#M23765</link>
      <description>&lt;P&gt;Sure that's possible. But are you sure you want to have this field as an &lt;A href="http://docs.splunk.com/Splexicon:Indexedfield"&gt;indexed field&lt;/A&gt;? I would suggest you use a search time field extraction, but feel free to ask again if you really need the indexed extraction.&lt;/P&gt;

&lt;P&gt;For a search time field, you can either use a calculated field or add a field extraction. A calculated field could be done like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval SLATime=mvindex(split(FileName, "."), 0)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;provided there are no &lt;CODE&gt;.&lt;/CODE&gt; in the file name before the one delimiting the file extension (.log). Simply add the part after &lt;CODE&gt;eval&lt;/CODE&gt; as a calculated field.&lt;BR /&gt;
For a field extraction, you could use a &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Managefieldtransforms"&gt;transform stanza&lt;/A&gt; to extract the file name (without the extension) from the FileName field with a regex.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2015 10:39:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Add-a-static-field-during-indexing/m-p/219419#M23765</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-11-05T10:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: Add a static field during indexing</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Add-a-static-field-during-indexing/m-p/219420#M23766</link>
      <description>&lt;P&gt;Jeff - Thanks for your answer.&lt;BR /&gt;
To just give you a background, there are 100's of file names and can follow n number of patterns like &lt;EM&gt;.log,&lt;/EM&gt;,&lt;EM&gt;.csv,&lt;/EM&gt;.xls,etc. so I can't go with the log format type, rather I know the list of files i need to look.&lt;/P&gt;

&lt;P&gt;SO I need to assign a static SLAtime field for those patterns i know.&lt;/P&gt;

&lt;P&gt;FileName=(star)filename1(star)&lt;BR /&gt;
FileName=(star)filename2(star)&lt;/P&gt;

&lt;P&gt;At both end of the filename there can be dynamic text keep on vary daily , like date or time appended to it.&lt;/P&gt;

&lt;P&gt;Which is the best way to go for this requirement ?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2015 12:43:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Add-a-static-field-during-indexing/m-p/219420#M23766</guid>
      <dc:creator>xbbj3nj</dc:creator>
      <dc:date>2015-11-05T12:43:53Z</dc:date>
    </item>
    <item>
      <title>Re: Add a static field during indexing</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Add-a-static-field-during-indexing/m-p/219421#M23767</link>
      <description>&lt;P&gt;If you want to make the field dependent of the value of the FileName field, then I'd suggest going with a field extraction based on a transform stanza. That way, you can define a regex which only captures a value for SLATime if the regex matches, and SLATime won't contain data if it doesn't.&lt;BR /&gt;
Assuming that's what you want to do, you need to create the extraction in transforms.conf like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[some_name]
REGEX = (?&amp;lt;SLATime&amp;gt;[\S]+\s[APM]+)
SOURCE_KEY = FileName
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;where your would need to adjust the REGEX to capture your other desired values as well (this one will only capture SLATime in the format you described in your question).&lt;BR /&gt;
You will then need to define a stanza like this in props.conf to apply the above extraction to a sourcetype/source/host:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[some_sourcetype or host::some_host or source::some_source]
REPORT-something = some_name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Check the docs for all that &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Createandmaintainsearch-timefieldextractionsthroughconfigurationfiles"&gt;here&lt;/A&gt;. You can of course also do the same via the Web Interface, the docs for that are &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Managefieldtransforms#Create_a_new_field_transform"&gt;here&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2015 13:03:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Add-a-static-field-during-indexing/m-p/219421#M23767</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-11-05T13:03:30Z</dc:date>
    </item>
    <item>
      <title>Re: Add a static field during indexing</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Add-a-static-field-during-indexing/m-p/219422#M23768</link>
      <description>&lt;P&gt;Ok , got what you say here.&lt;BR /&gt;
So  I need to use transforms.conf. Could you try for this below ?&lt;/P&gt;

&lt;P&gt;Set 1 :&lt;BR /&gt;
Pattern in logs : (star)BWA_SHADOW_EXTRACT_MC_CCP_VM_ASOF(star) &lt;BR /&gt;
Actual name : 2015_BWA_SHADOW_EXTRACT_MC_CCP_VM_ASOF_Nov5&lt;BR /&gt;
Create fields like &lt;STRONG&gt;hourSla&lt;/STRONG&gt; - 7 &lt;STRONG&gt;MinuteSLA&lt;/STRONG&gt;-30   [because SLA time is 7:30 AM, want to create these fields to compare it later with actual transmssion time]&lt;/P&gt;

&lt;P&gt;Set2 : &lt;BR /&gt;
Pattern in logs:(star)Source_To_Source_Exception_Report(star) &lt;BR /&gt;
Actual name : 2015_Source_To_Source_Exception_Report_Nov5&lt;BR /&gt;
Create fields like &lt;STRONG&gt;hourSla&lt;/STRONG&gt; - 9 &lt;STRONG&gt;Minute SLA&lt;/STRONG&gt; - 45  [because SLA time is 9:45 AM, want to create these fields to compare it later with actual transmssion time]&lt;/P&gt;

&lt;P&gt;Background is im trying to build a SLA tracking dashboard which compares the actual transmission time and SLA time and display it as "SLA Missed" OR "SLA MET"&lt;/P&gt;

&lt;P&gt;Filename                                                                               SLAtime           Actualtime              SLAstatus&lt;BR /&gt;
2015_BWA_SHADOW_EXTRACT_MC_CCP_VM_ASOF_Nov5   7:30 AM          7:32 AM                     MISSED&lt;BR /&gt;
2015_Source_To_Source_Exception_Report_Nov5                9:45 AM          9:00 AM                     MET&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:49:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Add-a-static-field-during-indexing/m-p/219422#M23768</guid>
      <dc:creator>xbbj3nj</dc:creator>
      <dc:date>2020-09-29T07:49:05Z</dc:date>
    </item>
    <item>
      <title>Re: Add a static field during indexing</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Add-a-static-field-during-indexing/m-p/219423#M23769</link>
      <description>&lt;P&gt;There is no info on the time (7:30) within those names. To extract the date, you could use this regex&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?&amp;lt;year_sla&amp;gt;\d{4})_BWA_SHADOW_EXTRACT_MC_CCP_VM_ASOF_(?&amp;lt;month_sla&amp;gt;\w{3})(?&amp;lt;day_sla&amp;gt;\d+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to extract to individual fields for the first set and&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?&amp;lt;year_sla&amp;gt;\d{4})_Source_To_Source_Exception_Report_(?&amp;lt;month_sla&amp;gt;\w{3})(?&amp;lt;day_sla&amp;gt;\d+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;for the second - see the idea?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2015 14:38:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Add-a-static-field-during-indexing/m-p/219423#M23769</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-11-05T14:38:44Z</dc:date>
    </item>
    <item>
      <title>Re: Add a static field during indexing</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Add-a-static-field-during-indexing/m-p/219424#M23770</link>
      <description>&lt;P&gt;No I don't,&lt;/P&gt;

&lt;P&gt;Apologize for the filename.&lt;/P&gt;

&lt;P&gt;Please consider this ,&lt;/P&gt;

&lt;P&gt;abcdeeeee*&lt;EM&gt;BWA_SHADOW_EXTRACT_MC_CCP_VM_ASOF&lt;/EM&gt;&lt;EM&gt;abcdeeee&lt;BR /&gt;
abcdeeeee&lt;/EM&gt;&lt;EM&gt;Source_To_Source_Exception_Report&lt;/EM&gt;*abcdeeee&lt;/P&gt;

&lt;P&gt;I only know these highlighted pattern and I'd want to assign static SLA time now as individual fields , &lt;STRONG&gt;hourSLA and minuteSLA&lt;/STRONG&gt; for each of them.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:49:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Add-a-static-field-during-indexing/m-p/219424#M23770</guid>
      <dc:creator>xbbj3nj</dc:creator>
      <dc:date>2020-09-29T07:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: Add a static field during indexing</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Add-a-static-field-during-indexing/m-p/219425#M23771</link>
      <description>&lt;P&gt;Oh, so you want to capture whatever is before BWA or Source? Then do it like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?&amp;lt;stuff_before&amp;gt;.+?)(?:BWA_SHADOW_EXTRACT_MC_CCP_VM_ASOF|Source_To_Source_Exception_Report)(?&amp;lt;stuff_after&amp;gt;.+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You'd obviously have to rename the capturing groups to something appropriate (I can't see whether hourSLA or minuteSLA comes before the middle part).&lt;/P&gt;

&lt;P&gt;By the way, you want to check out a tool such as regex101.com to help you with all your regex needs.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2015 16:34:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Add-a-static-field-during-indexing/m-p/219425#M23771</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-11-05T16:34:03Z</dc:date>
    </item>
  </channel>
</rss>

