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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

Data Management Digest – May 2026

Welcome to the May 2026 edition of Data Management Digest!   As your trusted partner in data innovation, the ...