Getting Data In

After setting non-system default timezone external commands fail with error code 1 or "ImportError: No module named site"

IgorB
Path Finder

In new 4.3 instance running on Win2008 R2, external commands (e.g. sendemail) have started failing with errors like the one below.

03-01-2012 09:20:26.862 +0000 ERROR script - External search command 'sendemail' returned error code 1.
03-01-2012 09:20:26.831 +0000 ERROR ScriptRunner - stderr from 'C:\Program Files\Splunk\etc\apps\search\bin\sendemail.py': ImportError: No module named site

I can't pinpoint the problem to a particular application installation or configuration change, all I can say is that everything has worked fine when the instance was first installed, but at some point we've noticed that the mails have stopped coming and then we've found the errors like the one in the example.

Tags (2)
1 Solution

IgorB
Path Finder

We found what was triggering the problem. Comes out it's the per-user timezone setting (new in 4.3). So once you set the user's timezone to anything other than the system's default timezone, you'll encounter the following problems:

  1. Searches utilizing external search commands, e.g. xmlkv, will start failing showing red bar with messages like "External search command 'xmlkv' returned error code 1.". There will be no traces of an error in splunkd.log.
  2. 'Send Email' alert action and other scripts, e.g. "backfill data" in Deployment Monitor app will also fail, but at least will leave trace in splunkd.log:

03-01-2012 09:20:26.862 +0000 ERROR script - External search command 'sendemail' returned error code 1.
03-01-2012 09:20:26.831 +0000 ERROR ScriptRunner - stderr from 'C:\Program Files\Splunk\etc\apps\search\bin\sendemail.py': ImportError: No module named site

View solution in original post

smeier
Path Finder

I wanted to upvote IgorB's answer, but I don't have enough points 😛

Anyway- you saved us too, thank you!

0 Karma

patrikan
Engager

Thank you, i can confirm that setting the "System Default timezone" made my email alerts work again.
I dont know how you found it, but a big thank you for posting it, saved my day 🙂

IgorB
Path Finder

The credit should go to my customer - Eyal P.

0 Karma

IgorB
Path Finder

We found what was triggering the problem. Comes out it's the per-user timezone setting (new in 4.3). So once you set the user's timezone to anything other than the system's default timezone, you'll encounter the following problems:

  1. Searches utilizing external search commands, e.g. xmlkv, will start failing showing red bar with messages like "External search command 'xmlkv' returned error code 1.". There will be no traces of an error in splunkd.log.
  2. 'Send Email' alert action and other scripts, e.g. "backfill data" in Deployment Monitor app will also fail, but at least will leave trace in splunkd.log:

03-01-2012 09:20:26.862 +0000 ERROR script - External search command 'sendemail' returned error code 1.
03-01-2012 09:20:26.831 +0000 ERROR ScriptRunner - stderr from 'C:\Program Files\Splunk\etc\apps\search\bin\sendemail.py': ImportError: No module named site

Get Updates on the Splunk Community!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...