Getting Data In

splunkd.exe environment variables SPLUNK_HOME PYTHONPATH etc

hvram
New Member

Hi
I installed Splunk on my laptop (Windows 7 64 bit) and things worked fine . I stopped the Windows service and was playing around with some Python modules

Now i am able to start Splunkd from the command line IF I set the environment variables SPLUNK_HOME, SPLUNK_DB,PYTHONHOME . But if I start as a service it does not work (i.e. net start splunkd )

How do I set the enviroment variables ?

Regards
Haro

0 Karma

alacercogitatus
SplunkTrust
SplunkTrust

It sounds as if you corrupted the Splunk install a bit. I'd uninstall / reinstall to have those variables restored. You can also start splunk like this:

cd C:
cd C:\Program Files\Splunk\bin
splunk.exe disable webserver
splunk.exe start

This should turn off the splunkweb, and then start Splunk correctly. Running splunkd.exe is not an option. If it still fails with a Python Error, add the Splunk Path back to the Environment Variable. http://www.itechtalk.com/thread3595.html

0 Karma

HiroshiSatoh
Champion

Are you sure you want to exist "site.py"? Or, do you not broken?
A similar message is displayed if you remove the "site.py" from "\LIB".

0 Karma

hvram
New Member

This is the error that I see in the logs

07-17-2013 15:12:23.681 +0530 ERROR loader - File "D:\Splunk\Python-2.7\Lib\site-packages\site.py", line 74, ..
07-17-2013 15:12:23.681 +0530 ERROR loader - raise ImportError("Couldn't find the real 'site' module")
07-17-2013 15:12:23.681 +0530 ERROR loader - ImportError: Couldn't find the real 'site' module

I can solve this problem by starting splunkd from the command line by setting SPLUNK_HOME, SPLUNKDB , PYTHONHOME and then start splunkd . The logs say that splunk has started

0 Karma

hvram
New Member

I understand that I should not be doing it . But as I mentioned :
I installed a couple of Python modules which caused changes to PYTHONPATH etc
So I have been trying to debug why it stopped and figured these .

0 Karma

Ayn
Legend

You're saying again though that you're running "splunkd from a command line" - you shouldn't be running splunkd directly at all, ever, because you need to run splunk which takes care of setting up the environment variables and a bunch of other things before invoking splunkd.

0 Karma

hvram
New Member

No I am trying to run splunkd as a service . If I run from command line I figured out that I need to set certain environment variables . I would like to set these variables and then run as a service . The reason i would like to do this is because I can run splunkd from a command line but I cannot run splunkweb

0 Karma

Ayn
Legend

Do you mean you're trying to run splunkd.exe instead of splunk.exe? Because splunkd.exe is not meant to be executed directly from the command line.

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...