Getting Data In
Highlighted

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

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 SPLUNKHOME 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?




| eval message="Happy Splunking!!!"


Highlighted

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

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!

Highlighted

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

Path Finder

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

0 Karma
Highlighted

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

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
Highlighted

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

Legend

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

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




| eval message="Happy Splunking!!!"


0 Karma
Highlighted

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

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
Highlighted

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

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.




| eval message="Happy Splunking!!!"


0 Karma
Highlighted

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

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.




| eval message="Happy Splunking!!!"


Highlighted

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

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.

Highlighted

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

Legend

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




| eval message="Happy Splunking!!!"


0 Karma