5

I have postgresql which stores some data as json fields, eg:

{"adults":2,"children":{"total":0,"ages":[]}} 

I'm using logstash-input-jdbc plugin to process the data
How do i parse json from jdbc? From logs i see that the fields arrive as PGObject:

"travelers_json" => #<Java::OrgPostgresqlUtil::PGobject:0x278826b2>

which has a value and type properties.

I've tried using json filter, but i don't know how to access the value property to feed to json filter? What i've tried:

 source => "[travelers_json][value]"
 source => "travelers_json.value"
 source => "%{travelers_json.value}"

I must be missing something very obvious here?

gerasalus
  • 7,538
  • 6
  • 44
  • 66

1 Answers1

0

Ok, so the simpliest way was to convert json to text in postgresql:

SELECT travelers_json::TEXT from xxx

but i still would like to know how to access that PGobject

gerasalus
  • 7,538
  • 6
  • 44
  • 66