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?
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
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.
@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.
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.
That is the first step (thanks for documenting as I had missed it)...however even after that above steps will be required.
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
@poete, have you tried till the Rebuild Visualization step?
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.
@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
.
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!
Hi @Frobinson and @niketnilay,
Is this issue fixed? If yes, what is the work around?