Logstash Error: LoadError: no such file to load -- pg

Hi, I am trying to sync a postgres database with elastic search. My file is the following:

    input {
      jdbc {
        jdbc_driver_library => "~/logstash/postgresql-42.2.14.jar" 
        jdbc_driver_class => "org.postgresql.Driver"
        jdbc_connection_string => "REDACTED"
        jdbc_user => "dev"
        statement => "SELECT * FROM items"
      }
    }
    output {
      stdout {
        codec => rubydebug #outputs the same thing as elasticsearch in stdout to facilitate debugging
      }
      elasticsearch {
        hosts => "localhost:9200"
        index => "items"
        document_type => "item"
        document_id => "%{id}"
      }
    }

I installed logstash using the .tar.gz file.
When I run my logstash conf file, I get the following error:

      Error: LoadError: no such file to load -- pg
      Exception: Sequel::AdapterNotFound
      Stack: org/jruby/RubyKernel.java:974:in `require'

I've tried installing the ruby gem, pg, on my laptop, but the error still comes up. I am using a Macbook and I am very new to logstash, any help is appreciated, thank you.

put the complete path, ie "/etc/logstash/postgres-42.2.14.jar"

Yeah, in my actual project, I have the full path, I just left it out here. The jar file is in a folder named logstash, which is in my project.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.