Blame


1 700fe2b1 2020-05-10 op This is more of a note to the future myself rather than a proper post.
2 700fe2b1 2020-05-10 op However...
3 700fe2b1 2020-05-10 op
4 700fe2b1 2020-05-10 op I've got an error trying to synchronize elasticsearch and postgresql
5 700fe2b1 2020-05-10 op using logstash. My configurations was along the lines of
6 700fe2b1 2020-05-10 op
7 a3ab6f61 2020-09-22 op ```logstash
8 700fe2b1 2020-05-10 op input {
9 700fe2b1 2020-05-10 op jdbc {
10 700fe2b1 2020-05-10 op jdbc_connection_string => "jdbc:postgresql://192.168.2.156:5432/chiaki"
11 700fe2b1 2020-05-10 op jdbc_user => "chiaki"
12 700fe2b1 2020-05-10 op jdbc_driver_library => "/path/to/postgresql-42.2.12.jre7.jar"
13 700fe2b1 2020-05-10 op jdbc_driver_class => "org.postgresql.Driver"
14 700fe2b1 2020-05-10 op jdbc_validate_connection => true
15 700fe2b1 2020-05-10 op statement => "select * from foo"
16 700fe2b1 2020-05-10 op }
17 700fe2b1 2020-05-10 op }
18 700fe2b1 2020-05-10 op
19 700fe2b1 2020-05-10 op output {
20 700fe2b1 2020-05-10 op elasticsearch {
21 700fe2b1 2020-05-10 op hosts => ["http://localhost:9200"]
22 700fe2b1 2020-05-10 op index => "foo"
23 700fe2b1 2020-05-10 op document_id => "%{the_pk}"
24 700fe2b1 2020-05-10 op doc_as_upsert => true
25 700fe2b1 2020-05-10 op }
26 700fe2b1 2020-05-10 op }
27 700fe2b1 2020-05-10 op ```
28 700fe2b1 2020-05-10 op
29 700fe2b1 2020-05-10 op But it error'd with something like "role _logstash does not exists."
30 700fe2b1 2020-05-10 op
31 700fe2b1 2020-05-10 op I haven't really tracked down the issued, but found a workaround:
32 700fe2b1 2020-05-10 op specify the user *also* in the connection string.
33 700fe2b1 2020-05-10 op
34 700fe2b1 2020-05-10 op It's quite strange, since the `jdbc_user` params is required.
35 700fe2b1 2020-05-10 op
36 700fe2b1 2020-05-10 op P.S. the error was about a missing `_logstash` role because on OpenBSD
37 700fe2b1 2020-05-10 op that user is created for logstash. This was a hint that `jdbc_user`
38 700fe2b1 2020-05-10 op wasn't respected.