Getting Data In

Why does Splunk Custom Visualization API result in a build error on a Windows Machine?

niketn
Legend

I was trying to use Custom Visualization API to build my own custom visualization using tutorial from Splunk Docs (similar available on Splunk Dev also : http://docs.splunk.com/Documentation/Splunk/6.5.2/AdvancedDev/CustomVizTutorial ).

Following is the error I received while trying to build Custom Visualization on Windows System.

> $SPLUNK_HOME/bin/splunk cmd node ./node_modules/webpack/bin/webpack.js

'$SPLUNK_HOME' is not recognized as an internal or external command,
operable program or batch file.

Following is the error from npm-debug.log

13 info lifecycle standin@1.0.0~build: Failed to exec build script
14 verbose stack Error: standin@1.0.0 build: `$SPLUNK_HOME/bin/splunk cmd node ./node_modules/webpack/bin/webpack.js`

I was not sure if it is picking my SPLUNK_HOME path set in Windows, or has it been written only to work on Linux/Mac systems.
I have set both SPLUNK_HOME and $SPLUNK_HOME as the Splunk installation path on my machine(verified the same using echo command as below).

echo %$SPLUNK_HOME%
echo %SPLUNK_HOME%

Can anyone confirm whether Custom Visualization worked on Windows machine? If yes, what mistake do you think I might be doing while initial setup?

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

emeelan_splunk
Splunk Employee
Splunk Employee

Hi Splunkers,

Thanks for the question (and answers). You can also find information about the configuration differences for Windows and *NIX machines here: http://docs.splunk.com/Documentation/Splunk/6.6.2/Admin/DifferencesbetweenunixandwindowsinSplunkoper...

Cheers,
Eve

Eve Meelan
Technical Writer
Splunk >
emeelan@splunk.com

niketn
Legend

Thanks @emeelan [Splunk], for providing the link to configuration differences between *NIX and Windows machines. I am aware of the differences as well. However, the issue was with documented steps of building Custom Visualizations using Custom Visualization API in Splunk documentation: http://docs.splunk.com/Documentation/Splunk/latest/AdvancedDev/CustomVizTutorial

As I have mentioned in my answer below, package.json needs to be changed for Windows machine as per Environment Variable naming convention. If this can be tested by Splunk Development Team and can be documented on Splunk Docs it would be great.

Further, as you have suggested the reference to http://docs.splunk.com/Documentation/Splunk/latest/Admin/DifferencesbetweenunixandwindowsinSplunkope... should also be available in Build Custom Visualization documentation (at least as related pages) so that developers coming from separate backgrounds can refer the same as per their build machine/environment.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

niketn
Legend

@frobinson, @hwakonwalk,

I was able to build the visualization by changing SPLUNK_HOME Windows Environment Variable in package.json from *NIX format (i.e. $SPLUNK_HOME) to Windows (i.e. %SPLUNK_HOME%).

  "scripts": {
    "build": "%SPLUNK_HOME%/bin/splunk cmd node ./node_modules/webpack/bin/webpack.js",
    "devbuild": "%SPLUNK_HOME%/bin/splunk cmd node ./node_modules/webpack/bin/webpack.js --progress",
    "watch": "%SPLUNK_HOME%/bin/splunk cmd node ./node_modules/webpack/bin/webpack.js -d --watch --progress"
  }

Only hiccup was that the label "Radial Meter" set for Visualization got picked up as $label, which I had to manually edit in Splunk UI from App Manager > Settings > Name.

Please see if Dev team can verify and confirm the same.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

jihape
Path Finder

I got it working by reinstalling Splunk into a path without spaces. Then doing the above.

The default Windows (C:\Program Files\Splunk) kept throwing errors.

niketn
Legend

That is the first step (thanks for documenting as I had missed it)...however even after that above steps will be required.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

poete
Builder

Hi,

I have the same issue on windows with Splunk 6.6.2. I found a way to get the result, which is:
Add the path to splunk.exe to the windows Path environment variable (in my case C:\Program FIles\splunk\bin), and then run in the cmd window (as administrator), the line mentioned as raisng the problem (in your case, run splunk cmd node ./node_modules/webpack/bin/webpack.js from the same location). It did solve the issue on my windows laptop.
Hope it helps

0 Karma

niketn
Legend

@poete, have you tried till the Rebuild Visualization step?

http://docs.splunk.com/Documentation/Splunk/latest/AdvancedDev/CustomVizTutorial#Rebuild_the_visuali...

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

poete
Builder

Of course I did, and as it did not work (and I think this is the subject of this post), I tried to figure out a way to make it work. Running the Rebuild Visualization step in verbose mode helped me to find the walk around I mentioned in my previous post. Of course ths is not a perfect solution, but at least I was able to build my Viz on windows.

0 Karma

niketn
Legend

@poete, I tried the steps you had mentioned and also added the Path for exe as you mentioned. However, the build failed again.

I have posted my changes to package.json which would allow to build the visualization on Windows machine without changes to any other documented steps.

The Environment Variable in Windows would be SPLUNK_HOME and the same would be accessed in build script with %SPLUNK_HOME% instead of $SPLUNK_HOME.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

frobinson_splun
Splunk Employee
Splunk Employee

Hi @niketnilay,
I've looked into your question with our engineering team and you are correct that there are differences when building custom visualizations on a Windows platform. We will need to research this further to get full details and update our documentation. In the meantime, posting here is a good option and I'll keep an eye on this thread to see what advice our community provides.

Hope this helps!

hwakonwalk
Path Finder

Hi @Frobinson and @niketnilay,
Is this issue fixed? If yes, what is the work around?

0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...