# Logstash base64 encode/decode from jdbc into Elastic does not generate same results

**URL:** <https://discuss.elastic.co/t/logstash-base64-encode-decode-from-jdbc-into-elastic-does-not-generate-same-results/142548>\
**Category:** Logstash\
**Created:** [August 1, 2018, 11:11am UTC](https://discuss.elastic.co/t/logstash-base64-encode-decode-from-jdbc-into-elastic-does-not-generate-same-results/142548 "2018-08-01T11:11:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fcoll](https://avatars.discourse-cdn.com/v4/letter/f/51bf81/32.png) [@fcoll](https://discuss.elastic.co/u/fcoll)\
**Post date:** [August 1, 2018, 11:11am UTC](https://discuss.elastic.co/t/logstash-base64-encode-decode-from-jdbc-into-elastic-does-not-generate-same-results/142548/1 "2018-08-01T11:11:49Z")

</div>

Hi, I am trying to ingest BLOB data using jdbc input plugin into Elastic.  
I use a Base64 encoder filter to before ingesting into Elastic and viceversa when reading.  
Both logstash configurations (from Oracle-\>logststash-\>Elastic and Elastic-\>logstash-\>file works apparently OK with no errors, but the binary content retrieved is different from the one ingested.

I am not expert on ELK framework so probably doing something wrong.  
Any feedback highly appreciated.

* * *

Ingest config:  
input {  
jdbc {  
jdbc\_driver\_library =\> "/mnt/data/ojdbc7.jar"  
jdbc\_driver\_class =\> "Java::oracle.jdbc.OracleDriver"  
jdbc\_connection\_string =\> "jdbc:oracle:thin:@server:1521/XE"  
jdbc\_user =\> ""  
jdbc\_password =\> ""  
statement =\> "SELECT content from MYTABLE"  
# Declare blob fields as binary, to avoid text conversions  
columns\_charset =\> {  
"content" =\> "BINARY"  
}  
}  
}

filter {  
base64 {  
field =\> "content"  
action =\> "encode"  
}  
}

output {  
elasticsearch {  
hosts =\> "elasticsearch"  
index =\> "demo"  
}  
}

* * *

Export config:  
input {  
elasticsearch {  
hosts =\> "elasticsearch"  
index =\> "demo"  
query =\> '{ "query": { "query\_string": { "query": "\*" } } }'  
size =\> 500  
scroll =\> "5m"  
docinfo =\> true  
}  
}

filter {  
base64 {  
field =\> "content"  
}  
}

output {  
file {  
codec =\> line { format =\> "%{content}"}  
path =\> "/mnt/data/output/%{[@metadata][\_id]}"  
}  
}

---

<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:** [August 29, 2018, 11:12am UTC](https://discuss.elastic.co/t/logstash-base64-encode-decode-from-jdbc-into-elastic-does-not-generate-same-results/142548/2 "2018-08-29T11:12:07Z")

</div>

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