Bug: No SINCEDB_DIR or HOME environment variable set

Description

Hello,

The logstash-agent service keeps crashing on me. I'm using the logstash-agent-init from http://logstashbook.com/code/3/ on my CentOS server. I've been following the Logstash book and I've created the shipper.conf file exactly by the book, but the service continues to crash. Below is my shipper.log file:

{:timestamp=>"2014-03-05T15:53:07.448000-0600", :message=>"Using milestone 2 input plugin 'file'. This plugin should be stable, but if you see strange behavior, please let us know! For more information on plugin milestones, see http://logstash.net/docs/1.3.3/plugin-milestones", : level=>:warn}
{:timestamp=>"2014-03-05T15:53:07.700000-0600", :message=>"Using milestone 2 output plugin 'redis'. This plugin should be stable, but if you see strange behavior, please let us know! For more information on plugin milestones, see http://logstash.net/docs/1.3.3/plugin-milestones", :level=>:warn}
{:timestamp=>"2014-03-05T15:53:14.227000-0600", :message=>"Registering file input", ath=>["/var/log/secure", "/var/log/messages"], :level= >:info}
{:timestamp=>"2014-03-05T15:53:14.227000-0600", :message=>"Registering file input", ath=>["/var/log/secure", "/var/log/messages"], :level= >:info}
{:timestamp=>"2014-03-05T15:53:14.230000-0600", :message=>"No SINCEDB_DIR or HOME environment variable set, I don't know where to keep track of the files I'm watching. Either set HOME or SINCEDB_DIR in your environment, or set sincedb_path in in your logstash config for the file input with path '[\"/var/log/secure\", \"/var/log/messages\"]'", :level=>:error}
{:timestamp=>"2014-03-05T15:53:14.236000-0600", :message=>"---------------------------------------------------------\n| An unexpected erro r occurred. This is probably a bug.

Please help.

testing discovered

Gliffy Diagrams

Activity

Show:

MattM May 1, 2014 at 1:43 AM

I'm running into the same issue with 1.4.1 as well.

Jon Stevens April 19, 2014 at 12:44 AM

I just ran into this issue with 1.4.1 rpm that I built from master just now.

For the rpm, why not default this to something like /opt/logstash/sincedb-access instead of relying on $HOME?

James Turnbull March 16, 2014 at 5:47 PM

Okay - it looks like this is indeed a bug in the 1.3.3 RPMs but its fixed in master and the 1.4.0 RPMS will work.

In the meantime Jason's workaround of specifying the sincedb_path option in the file input should work. Please comment if it does not.

James Turnbull March 16, 2014 at 5:42 PM

See https://logstash.jira.com/browse/LOGSTASH-1994 - I think there is actually an issue here.

Robert - the next release of the book will do away with the current manual installation in favor of the packages and their init scripts. So at least this will centralize the problem(s) in one place in future.

Jason Kendall March 16, 2014 at 5:14 PM
Edited

Let me be more clear, and see if it will help the situation.

This has nothing todo with the RPM. Any logstash install when running as a service will have this problem. You typically run services using a service user. Service users typically do not have a $HOME directory.

Since there is no $HOME directory or environment variable, the default value for the sincedb_path can not be valid.

There is a number of options: One (which I linked to), you can set the value in the configuration file. This is the most used solution. Another would be to set the $HOME directory in the INIT script. However, this isn't recommended as it could be overwritten, and a lot of the times there is no $HOME directory for service accounts.

The configuration for sincedb_path is entirely up to the system administrator on where to set it. Some options could be /var/run (This is a common place to put running related files, like pid, sock, and lock files), /var/cache could also be chosen as it could be considered a cache value. Although, I would suggest a directory under those, such as lssincedbs.

Just be careful, since you can have multiple file inputs, you want to ensure the directories are different as to not overwrite previous ones.

While I accept the documentation could be more clear on this matter, there is no bug.

Won't Fix

Details

Assignee

Reporter

Affects versions

Created March 6, 2014 at 5:04 PM
Updated May 1, 2014 at 1:43 AM
Resolved March 7, 2014 at 6:59 PM