[Resolved] Logstash Custom Plugin - Unable to create session to Neo4j within Logstash


(Justin Bovee) #1

I am having issues with a custom plugin and not exactly where to turn.

I am building a custom Logstash output plugin to build our Neo4j models. Running the code externally with jruby included with Logstash, I have no issues creating a session to our server. If run as a plugin, I end up with an undefined method error.
undefined method graph_db' for #<Neo4j::Server::CypherSession:0x3922b0a5>

http://pastebin.com/kV5rHxpF

/opt/logstash/bin/logstash version
logstash 2.1.1

Neo4j Community Version 2.3.1

Gems (Tested with earlier versions with similar behavior
neo4j - 6.0.4
neo4j-community - 2.2.4.1

I can generate the error with the below code.

require "logstash/outputs/base"
require "logstash/namespace"
require 'neo4j'

class LogStash::Outputs::neo4jGraph < LogStash::Outputs::Base
config_name "neo4jgraph"
def register
@session = Neo4j::Session.open(:server_db,"http://localhost:7474", basic_auth: { username: "***", password: "***" })
end

def receive(event)
end
end

Any ideas or direction I can look?

Thank you!


(Justin Bovee) #2

This is solved. It happens that even though I was specifying server_db, neo4jrb assumed because I was using jruby that I meant embedded_db.

By setting the environment variable WITHOUT_NEO4J_EMBEDDED to TRUE, I am able to establish the session.


(system) #3