<?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 How to read a file and use the data inside in a eval function? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-read-a-file-and-use-the-data-inside-in-a-eval-function/m-p/354030#M104778</link>
    <description>&lt;P&gt;I am new using Splunk, sorry.&lt;BR /&gt;
 I need to separate a lot of subnets by name. I would like (txt) to read a file kind of:&lt;/P&gt;

&lt;P&gt;10.0.1.0/16 NAME1&lt;BR /&gt;
10.5.0.0/24 NAME2&lt;BR /&gt;
...&lt;/P&gt;

&lt;P&gt;I am using this search now :  | eval org=case(cidrmatch("10.118.68.0/23",src),"NAME1", cidrmatch("10.118.103.0/26",src_ip),"NAME2") | stats by org&lt;/P&gt;

&lt;P&gt;The question is that I have a lot of subnets and I need to simplify the query, and I wonder if is there any way to read a file in the eval function, using awk or something like that?&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Tue, 14 Mar 2017 15:31:06 GMT</pubDate>
    <dc:creator>langanix</dc:creator>
    <dc:date>2017-03-14T15:31:06Z</dc:date>
    <item>
      <title>How to read a file and use the data inside in a eval function?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-read-a-file-and-use-the-data-inside-in-a-eval-function/m-p/354030#M104778</link>
      <description>&lt;P&gt;I am new using Splunk, sorry.&lt;BR /&gt;
 I need to separate a lot of subnets by name. I would like (txt) to read a file kind of:&lt;/P&gt;

&lt;P&gt;10.0.1.0/16 NAME1&lt;BR /&gt;
10.5.0.0/24 NAME2&lt;BR /&gt;
...&lt;/P&gt;

&lt;P&gt;I am using this search now :  | eval org=case(cidrmatch("10.118.68.0/23",src),"NAME1", cidrmatch("10.118.103.0/26",src_ip),"NAME2") | stats by org&lt;/P&gt;

&lt;P&gt;The question is that I have a lot of subnets and I need to simplify the query, and I wonder if is there any way to read a file in the eval function, using awk or something like that?&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2017 15:31:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-read-a-file-and-use-the-data-inside-in-a-eval-function/m-p/354030#M104778</guid>
      <dc:creator>langanix</dc:creator>
      <dc:date>2017-03-14T15:31:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a file and use the data inside in a eval function?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-read-a-file-and-use-the-data-inside-in-a-eval-function/m-p/354031#M104779</link>
      <description>&lt;P&gt;What you need is to create a lookup table file with all those CIDR and name mapping, create a lookup transform to do cidr match. They you should be able to use lookup command to match and fetch name OR you can setup automatic lookup to get the name automatically. See this link for details.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/5916/using-cidr-in-a-lookup-table.html"&gt;https://answers.splunk.com/answers/5916/using-cidr-in-a-lookup-table.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2017 15:52:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-read-a-file-and-use-the-data-inside-in-a-eval-function/m-p/354031#M104779</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-03-14T15:52:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a file and use the data inside in a eval function?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-read-a-file-and-use-the-data-inside-in-a-eval-function/m-p/354032#M104780</link>
      <description>&lt;P&gt;Thank you very much for you answer!&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2017 15:55:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-read-a-file-and-use-the-data-inside-in-a-eval-function/m-p/354032#M104780</guid>
      <dc:creator>langanix</dc:creator>
      <dc:date>2017-03-14T15:55:39Z</dc:date>
    </item>
  </channel>
</rss>

