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

Ruby Gem (Tested with earlier versions with similar behavior) neo4j - 6.0.4

I can generate the error with the below plugin 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!

1 Answers1

0

Because you're using jRuby, the neo4j-core gem is making an assumption that you want to use embedded mode rather than server mode. We should find a better way to go about this, but for the moment if you use the WITHOUT_NEO4J_EMBEDDED environment variable with the value true it should load the proper files and fix your problem.

EDIT:

FYI I've made a pull request so that this can hopefully be easier: https://github.com/neo4jrb/neo4j-core/pull/244

Brian Underwood
  • 10,746
  • 1
  • 22
  • 34