<?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: Numpi import through Splunk script in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Numpi-import-through-Splunk-script/m-p/258439#M96121</link>
    <description>&lt;P&gt;Hi&lt;BR /&gt;
The basic objective is to do the right kind of parsing.&lt;BR /&gt;
The structure of the log file is in this format :&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;HR /&gt;

&lt;HR /&gt;

&lt;PRE&gt;&lt;CODE&gt;                Top 20 CPU Consuming Processes               
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;----------------------------------------------------------------- USER       PID %CPU %MEM    VSZ   RSS&lt;BR /&gt;
TTY      STAT START   TIME COMMAND&lt;BR /&gt;
oracle   18747  8.4  4.5 6545080&lt;BR /&gt;
1480668 ?     Ss   Nov28   5:03&lt;/P&gt;

&lt;H2&gt;oracleprod (LOCAL=NO) etc...&lt;/H2&gt;

&lt;HR /&gt;

&lt;PRE&gt;&lt;CODE&gt;                Top 20 Memory Consuming Processes            
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;----------------------------------------------------------------- USER       PID %CPU %MEM    VSZ   RSS&lt;BR /&gt;
TTY      STAT START   TIME COMMAND&lt;BR /&gt;
oracle   13342  6.0 10.9 6551532&lt;BR /&gt;
3587824 ?     Ss   Nov28  53:39&lt;/P&gt;

&lt;H2&gt;oracleprod (LOCAL=NO) etc..&lt;/H2&gt;

&lt;HR /&gt;

&lt;PRE&gt;&lt;CODE&gt;                   Server Processes                          
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;and so forth.. so there are 8 such tables in a single log file. Basic splunk parsing doesnt help and its not splitting into separate tables . So we thought we'll write a python script to parse the log files in splunk. We put the python script in the bin folder and under scripts option, selected the .py file , went to search app and ran the file. It's only generating the first line of code which is a test print command, that I wanted to check if its reading correctly or not. After that its not reading any of the lines.&lt;/P&gt;

&lt;P&gt;My question is : the python sript written uses a Numpy library and hence wanted to check if this is causing the issue for Splunk ,unable to import numpy library to read the python file&lt;/P&gt;

&lt;P&gt;I can send u the code and log file, if you can provide me ur mail id &lt;/P&gt;</description>
    <pubDate>Fri, 27 Jan 2017 06:50:47 GMT</pubDate>
    <dc:creator>hkmurali</dc:creator>
    <dc:date>2017-01-27T06:50:47Z</dc:date>
    <item>
      <title>Numpi import through Splunk script</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Numpi-import-through-Splunk-script/m-p/258437#M96119</link>
      <description>&lt;P&gt;I'm trying to parse a log file and written a python script to parse it&lt;BR /&gt;
However when I run it in Splunk search app, only the first line is being executed&lt;BR /&gt;
I had asked this question before ,  but now I realize it's because of import numpy command&lt;BR /&gt;
Is there anything special I should do for using numpy commands in a python script, placed in the bin folder&lt;/P&gt;

&lt;P&gt;print("Test Message for log")&lt;BR /&gt;
import numpy&lt;BR /&gt;
lines = [] # Declare an empty list named "lines"&lt;BR /&gt;
i=0&lt;BR /&gt;
end_position=[]&lt;BR /&gt;
with open ('$SPLUNK_HOME\etc\apps\search\bin\prm_rca.20161129_0000.log', 'rt') as in_file: &lt;BR /&gt;
    for line in in_file: # For each line of text in in_file, where the data is named "line",&lt;BR /&gt;
   print("Test Message within a loop")&lt;BR /&gt;
 lines.append(line.rstrip('\n')) # add that line to our list of lines, stripping newlines.&lt;BR /&gt;
        if "-----------------------------------------------------------------" in line:&lt;BR /&gt;
            end_position.append(i)&lt;BR /&gt;
        i=i+1&lt;BR /&gt;
Please help&lt;BR /&gt;
Objective : parse a very complex log file and make some meaningful analysis&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:35:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Numpi-import-through-Splunk-script/m-p/258437#M96119</guid>
      <dc:creator>hkmurali</dc:creator>
      <dc:date>2020-09-29T12:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: Numpi import through Splunk script</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Numpi-import-through-Splunk-script/m-p/258438#M96120</link>
      <description>&lt;P&gt;I do not understand your situation at all.  Show us your configuration files and a sample of your broken results and a mockup of your expected results.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2017 16:42:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Numpi-import-through-Splunk-script/m-p/258438#M96120</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-01-24T16:42:25Z</dc:date>
    </item>
    <item>
      <title>Re: Numpi import through Splunk script</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Numpi-import-through-Splunk-script/m-p/258439#M96121</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;
The basic objective is to do the right kind of parsing.&lt;BR /&gt;
The structure of the log file is in this format :&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;HR /&gt;

&lt;HR /&gt;

&lt;PRE&gt;&lt;CODE&gt;                Top 20 CPU Consuming Processes               
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;----------------------------------------------------------------- USER       PID %CPU %MEM    VSZ   RSS&lt;BR /&gt;
TTY      STAT START   TIME COMMAND&lt;BR /&gt;
oracle   18747  8.4  4.5 6545080&lt;BR /&gt;
1480668 ?     Ss   Nov28   5:03&lt;/P&gt;

&lt;H2&gt;oracleprod (LOCAL=NO) etc...&lt;/H2&gt;

&lt;HR /&gt;

&lt;PRE&gt;&lt;CODE&gt;                Top 20 Memory Consuming Processes            
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;----------------------------------------------------------------- USER       PID %CPU %MEM    VSZ   RSS&lt;BR /&gt;
TTY      STAT START   TIME COMMAND&lt;BR /&gt;
oracle   13342  6.0 10.9 6551532&lt;BR /&gt;
3587824 ?     Ss   Nov28  53:39&lt;/P&gt;

&lt;H2&gt;oracleprod (LOCAL=NO) etc..&lt;/H2&gt;

&lt;HR /&gt;

&lt;PRE&gt;&lt;CODE&gt;                   Server Processes                          
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;and so forth.. so there are 8 such tables in a single log file. Basic splunk parsing doesnt help and its not splitting into separate tables . So we thought we'll write a python script to parse the log files in splunk. We put the python script in the bin folder and under scripts option, selected the .py file , went to search app and ran the file. It's only generating the first line of code which is a test print command, that I wanted to check if its reading correctly or not. After that its not reading any of the lines.&lt;/P&gt;

&lt;P&gt;My question is : the python sript written uses a Numpy library and hence wanted to check if this is causing the issue for Splunk ,unable to import numpy library to read the python file&lt;/P&gt;

&lt;P&gt;I can send u the code and log file, if you can provide me ur mail id &lt;/P&gt;</description>
      <pubDate>Fri, 27 Jan 2017 06:50:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Numpi-import-through-Splunk-script/m-p/258439#M96121</guid>
      <dc:creator>hkmurali</dc:creator>
      <dc:date>2017-01-27T06:50:47Z</dc:date>
    </item>
    <item>
      <title>Re: Numpi import through Splunk script</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Numpi-import-through-Splunk-script/m-p/258440#M96122</link>
      <description>&lt;P&gt;Hi @hkmurali &lt;/P&gt;

&lt;P&gt;By default Splunk doesn't ship numpy package - I guess your script is not able to find the numpy package, have you installed numpy package inside Splunk?&lt;/P&gt;

&lt;P&gt;try to install Python for Scientific Computing app and check whether this will resolve your issue or not.&lt;/P&gt;

&lt;P&gt;Namaste,&lt;BR /&gt;
Manoj&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 10:02:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Numpi-import-through-Splunk-script/m-p/258440#M96122</guid>
      <dc:creator>jangid</dc:creator>
      <dc:date>2018-02-15T10:02:20Z</dc:date>
    </item>
  </channel>
</rss>

