Class: LogStash::Inputs::Neo4j

Inherits:
Base
  • Object
show all
Defined in:
lib/logstash/inputs/neo4j.rb

Overview

This plugin gets data from a Neo4j database in predefined intervals. To fetch this data uses a given Cypher query.

### Usage:

source, ruby

input {

neo4j {
  query => "MATCH (p:`Person`)-->(m:`Movie`) WHERE m.released = 2005 RETURN *"
  path  => "/foo/bar.db"
}

}

In embedded_db mode this plugin require a neo4j db 2.0.1 or superior. If using the remote version there is no major restriction.

Instance Method Summary collapse

Instance Method Details

#registerObject



43
44
45
46
47
# File 'lib/logstash/inputs/neo4j.rb', line 43

def register
  require "rufus/scheduler"
  require "logstash/inputs/neo4j-client"
  @client = Neo4jrb::Client.open(@path)
end

#run(queue) ⇒ Object

def register



49
50
51
52
53
54
55
# File 'lib/logstash/inputs/neo4j.rb', line 49

def run(queue)
  if @schedule
    setup_scheduler(queue)
  else
    fetch(queue)
  end
end

#stopObject

def run



57
58
59
# File 'lib/logstash/inputs/neo4j.rb', line 57

def stop
  @scheduler.shutdown if @scheduler
end