<?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 To create a field from the csv data in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/To-create-a-field-from-the-csv-data/m-p/101071#M21172</link>
    <description>&lt;P&gt;Hi Xperts,&lt;/P&gt;

&lt;P&gt;I Need to create a field which displays hostnames with the following data,&lt;/P&gt;

&lt;P&gt;1&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;1568    *NAIT US ICC Tibco Hawk Alerts  24/03/13 08:47  STOPPED :: BW Engine AFSDailyAndInitialLoad-A-550BwProcess-1911-14743 on ncdap-prd1911  Loanpath    Alert   High    00:15

11569   *NAIT US ICC Tibco Hawk Alerts  24/03/13 08:47  STOPPED :: BW Engine NAIT_AFS_BookingInterface-C-LP_AFS_BookingInterface_RequestMessage-1911-14743 on ncdap-prd1911 Loanpath    Alert   High    00:15

11570   *NAIT US ICC Tibco Hawk Alerts  24/03/13 08:47  STOPPED :: BW Engine IMPACS-C-IMPACS_LoanBooking_ReqRep-1911-14743 on ncdap-prd1911 Loanpath    Alert   High    00:15

11571   *NAIT US ICC Tibco Hawk Alerts  24/03/13 08:47  STOPPED :: BW Engine ICV_Customer_Interface-B-ICV_Get_Customer_Request-1911-14743 on ncdap-prd1914  Loanpath    Alert   High    00:15

11572   *NAIT US ICC Tibco Hawk Alerts  24/03/13 08:47  STOPPED :: BW Engine NAIT_AFS_BookingInterface-C-AFS_LP_BookingInterface_ResponseMessage-1911-14743 on ncdap-prd1921    Loanpath    Alert   High    00:15
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;in the above code, term staes with "ncdap-prd1911" "ncdap-prd1914" are nodes, i want to create a field "hostname" under which i want these nodes to filtered. How to proceed this.&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Paul&lt;/P&gt;</description>
    <pubDate>Fri, 19 Jul 2013 16:45:00 GMT</pubDate>
    <dc:creator>Paul_tcs</dc:creator>
    <dc:date>2013-07-19T16:45:00Z</dc:date>
    <item>
      <title>To create a field from the csv data</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/To-create-a-field-from-the-csv-data/m-p/101071#M21172</link>
      <description>&lt;P&gt;Hi Xperts,&lt;/P&gt;

&lt;P&gt;I Need to create a field which displays hostnames with the following data,&lt;/P&gt;

&lt;P&gt;1&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;1568    *NAIT US ICC Tibco Hawk Alerts  24/03/13 08:47  STOPPED :: BW Engine AFSDailyAndInitialLoad-A-550BwProcess-1911-14743 on ncdap-prd1911  Loanpath    Alert   High    00:15

11569   *NAIT US ICC Tibco Hawk Alerts  24/03/13 08:47  STOPPED :: BW Engine NAIT_AFS_BookingInterface-C-LP_AFS_BookingInterface_RequestMessage-1911-14743 on ncdap-prd1911 Loanpath    Alert   High    00:15

11570   *NAIT US ICC Tibco Hawk Alerts  24/03/13 08:47  STOPPED :: BW Engine IMPACS-C-IMPACS_LoanBooking_ReqRep-1911-14743 on ncdap-prd1911 Loanpath    Alert   High    00:15

11571   *NAIT US ICC Tibco Hawk Alerts  24/03/13 08:47  STOPPED :: BW Engine ICV_Customer_Interface-B-ICV_Get_Customer_Request-1911-14743 on ncdap-prd1914  Loanpath    Alert   High    00:15

11572   *NAIT US ICC Tibco Hawk Alerts  24/03/13 08:47  STOPPED :: BW Engine NAIT_AFS_BookingInterface-C-AFS_LP_BookingInterface_ResponseMessage-1911-14743 on ncdap-prd1921    Loanpath    Alert   High    00:15
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;in the above code, term staes with "ncdap-prd1911" "ncdap-prd1914" are nodes, i want to create a field "hostname" under which i want these nodes to filtered. How to proceed this.&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Paul&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2013 16:45:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/To-create-a-field-from-the-csv-data/m-p/101071#M21172</guid>
      <dc:creator>Paul_tcs</dc:creator>
      <dc:date>2013-07-19T16:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: To create a field from the csv data</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/To-create-a-field-from-the-csv-data/m-p/101072#M21173</link>
      <description>&lt;P&gt;Here is the discussion in the manual of how to &lt;A href="http://docs.splunk.com/Documentation/Splunk/5.0.3/Knowledge/Addfieldsatsearchtime"&gt;add fields at search time&lt;/A&gt;. In Splunk, this is called field extraction. &lt;BR /&gt;
You may want to create a "permanent" field extraction using the Interactive Field Extractor.&lt;BR /&gt;
If you want to create a field on the fly, during a search, you could do this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yoursearchhere
| rex "\son\s*(?&amp;lt;hostname&amp;gt;ncdap\S+)"
| stats count by hostname
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I just gave the &lt;CODE&gt;stats&lt;/CODE&gt; command as one example of what you can do. But, if you just want to filter the data, you don't need fields at all&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yoursearchhere NOT "ncdap-prd1911" NOT "ncdap-prd1914"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;assuming that "ncdap-prd1911" "ncdap-prd1914" does not appear anywhere else in the event text.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2013 17:23:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/To-create-a-field-from-the-csv-data/m-p/101072#M21173</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2013-07-19T17:23:03Z</dc:date>
    </item>
    <item>
      <title>Re: To create a field from the csv data</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/To-create-a-field-from-the-csv-data/m-p/101073#M21174</link>
      <description>&lt;P&gt;thanks a lot for your reply,&lt;/P&gt;

&lt;P&gt;here when am giving this rex, this display four host which am mentioned in the sample query. consider that am having many hostname in the log, how to extract the same.&lt;/P&gt;

&lt;P&gt;Also, i see one field hostname has been created when i view he contents, i see complete line of the log&lt;/P&gt;

&lt;P&gt;ncdap-prd1911 Loanpath    Alert   High    00:15&lt;/P&gt;

&lt;P&gt;instead i need only&lt;/P&gt;

&lt;P&gt;ncdap-prd1911&lt;/P&gt;

&lt;P&gt;how to achieve this.&lt;/P&gt;</description>
      <pubDate>Sat, 20 Jul 2013 05:24:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/To-create-a-field-from-the-csv-data/m-p/101073#M21174</guid>
      <dc:creator>Paul_tcs</dc:creator>
      <dc:date>2013-07-20T05:24:03Z</dc:date>
    </item>
    <item>
      <title>Re: To create a field from the csv data</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/To-create-a-field-from-the-csv-data/m-p/101074#M21175</link>
      <description>&lt;P&gt;any help on this?&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jul 2013 08:47:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/To-create-a-field-from-the-csv-data/m-p/101074#M21175</guid>
      <dc:creator>Paul_tcs</dc:creator>
      <dc:date>2013-07-21T08:47:30Z</dc:date>
    </item>
    <item>
      <title>Re: To create a field from the csv data</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/To-create-a-field-from-the-csv-data/m-p/101075#M21176</link>
      <description>&lt;P&gt;&lt;CODE&gt;yoursearchhere&lt;BR /&gt;
| rex "\son\s*(?&amp;lt;hostname&amp;gt;ncdap\S+)"&lt;BR /&gt;
| stats count by hostname&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;should work. This will extract all of the hostnames in the log, if you replace the first line with a general query like &lt;CODE&gt;sourcetype=ZZZZ&lt;/CODE&gt; where &lt;CODE&gt;ZZZZ&lt;/CODE&gt; is the sourcetype of the data.&lt;/P&gt;

&lt;P&gt;If you want to see the events, but only certain fields, you can do this&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;yoursearchhere&lt;BR /&gt;
| rex "\son\s*(?&amp;lt;hostname&amp;gt;ncdap\S+)"&lt;BR /&gt;
| table hostname&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;You could also filter like this&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;yoursearchhere&lt;BR /&gt;
| rex "\son\s*(?&amp;lt;hostname&amp;gt;ncdap\S+)"&lt;BR /&gt;
| where hostname="ncdap-prd1911" OR hostname="ncdap-prd1914"&lt;BR /&gt;
| stats count by hostname&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2013 17:49:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/To-create-a-field-from-the-csv-data/m-p/101075#M21176</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2013-07-22T17:49:24Z</dc:date>
    </item>
  </channel>
</rss>

