Quantcast
Channel: Active questions tagged jq - Stack Overflow
Viewing all articles
Browse latest Browse all 611

ETCD export as json and decode from base64 all key/values to human readable

$
0
0

Is there any easy command line option to export my entire ETCD database to json file but also decode the keys and values automatically from base64?

What I succeeded to the moment is this(example show 1x key/value):

   ./etcdctl get "" --prefix -w json | jq -r ".[] | .[]  " {"key": "YnktZGV2L21ldGEvc25hcHNob3RzL3Jvb3QtY29vcmQvcGFydGl0aW9ucy80NDAwNDc0MjQ2MTgzNjUxNzAvNDQwMDQ3NDI0NjE4MzY1MTcxX3RzNDQwMDQ5NDg5ODkxODE5NTI0","create_revision": 44536,"mod_revision": 44536,"version": 1,"value": "CPOB0OXRmdeNBhIIX2RlZmF1bHQYhIDgxN/V140GIPKB0OXRmdeNBg=="}

But I need to decode the entire database keys and values to human readable format?

Thanks

P.S.Final solution after @Jeff Mercado help:

1. /etcdctl get "" --prefix -w json | jq '.[]'> etcd_filter.txt2. Clear output to form array of objects [{},{} ...{}]3. cat etcd_filter.txt | jq '.[] | (.key, .value) |= @base64d'

jq playground


Viewing all articles
Browse latest Browse all 611


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>