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

**URL:** <https://discuss.elastic.co/t/logstash-error-loaderror-no-such-file-to-load-pg/237831>\
**Category:** Logstash\
**Created:** [June 19, 2020, 3:50pm UTC](https://discuss.elastic.co/t/logstash-error-loaderror-no-such-file-to-load-pg/237831 "2020-06-19T15:50:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arnav\_Parashar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arnav_parashar/32/46023_2.png) [@Arnav\_Parashar](https://discuss.elastic.co/u/Arnav_Parashar)\
**Post date:** [June 19, 2020, 3:50pm UTC](https://discuss.elastic.co/t/logstash-error-loaderror-no-such-file-to-load-pg/237831/1 "2020-06-19T15:50:54Z")

</div>

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

```auto
    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:

```auto
      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.

---

<div class="post-metadata">

**Author:** ![fadjar340](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fadjar340/32/43610_2.png) [@fadjar340](https://discuss.elastic.co/u/fadjar340)\
**Post date:** [June 19, 2020, 4:13pm UTC](https://discuss.elastic.co/t/logstash-error-loaderror-no-such-file-to-load-pg/237831/2 "2020-06-19T16:13:26Z")

</div>

> [@Arnav\_Parashar](#):
>
> `jdbc_driver_library => "~/logstash/postgresql-42.2.14.jar"`

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

---

<div class="post-metadata">

**Author:** ![Arnav\_Parashar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arnav_parashar/32/46023_2.png) [@Arnav\_Parashar](https://discuss.elastic.co/u/Arnav_Parashar)\
**Post date:** [June 19, 2020, 4:16pm UTC](https://discuss.elastic.co/t/logstash-error-loaderror-no-such-file-to-load-pg/237831/3 "2020-06-19T16:16:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 17, 2020, 4:16pm UTC](https://discuss.elastic.co/t/logstash-error-loaderror-no-such-file-to-load-pg/237831/4 "2020-07-17T16:16:57Z")

</div>

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