I created an App and in my inputs.conf have it calling a Windows batch file to execute an .exe, but the exe seems that it is not executed. I have tried multiple things based on some of posts I found, and haven't gotten it to work yet.
Here is what I currently have setup:
C:\Program Files\Splunk\etc\apps\LogViewer\bin is where my exe is that I want to run along with my batch file to run my exe.
call "C:\Program Files\Splunk\etc\apps\LogViewer\bin\LogginDB.exe"
C:\Program Files\Splunk\etc\apps\LogViewer\default\inputs.conf contains
[script:"C:\Program Files\Splunk\etc\apps\LogViewer\bin\LaunchLogging.bat"]
disabled = 0 # change to true to start the input, requires restart
host = SHE-STGSQLEXT1 # enter hostname here
index = main
interval = 30 #frequency to run the script
My exe is written to output a text file so i know for sure that it is not running and if I run the batch file manually the output is created.
Any one know what I am doing wrong?
I believe the issue is with your "script" stanza in inputs.conf. The correct syntax is "script://". Try:
## inputs.conf
[script://$SPLUNK_HOME\etc\apps\LogViewer\bin\LaunchLogging.bat]
I was able to resolve it. I think it is a combination of a syntax errors. In my first post I have a couple of lines in my inputs.conf where I have a comment after setting a property:
disabled = 0 # change to true to start the input, requires restart
I removed those comments and also tried your original suggestion of changing the value of my script path in my script stanza. I now have it set to the value of:
[script://$SPLUNK_HOME\etc\apps\LogViewer\bin\LaunchLogging.bat]
Thanks for your help.
Do you need a double backslash to indicat that you are not escape charachtering?
I can't type it here as the preview removes the second backslash. but I beleive that that is the problem.....
Hope that helps.
You do not have to escape slashes in inputs.conf file path specifiers.
One other thing, I put my .bat file in C:\Program Files\Splunk\bin\scripts and added a Data Input to this file and everything is working as I expected.
I'm assuming that $SPLUNK_HOME is a system variable. I checked my system variables and did not see that on so I added it and put the value as C:\Program Files\Splunk. The path to Python is part of my path.
If it is working in $SPLUNK_HOME\bin\scripts, but not in $SPLUNK_HOME\etc\apps\
I updated my script stanza by copying and pasting the line you provided, but it still is not launching.
I believe the issue is with your "script" stanza in inputs.conf. The correct syntax is "script://". Try:
## inputs.conf
[script://$SPLUNK_HOME\etc\apps\LogViewer\bin\LaunchLogging.bat]