rundeck-plugins / jq-json-logfilter Goto Github PK
View Code? Open in Web Editor NEWMap a json output to key/value context variables using java-jq library
Map a json output to key/value context variables using java-jq library
I'm wondering if it's possible to run the following in jq-filter in order to capture a value in a json output:
.[] | select( .address | contains (${Variables_Uplink_Update.ipAddress}))
The ${Variables_Uplink_Update.ipAddress} is a Global variable on the jobs.
Best regards!
Is it possible to use -r to get the raw output of the value? In rundeck, I am only able to create the filter itself, not jq -r 'filter'.
I've been testing out the 'jq-json-logfilter' with REST API reading, and I do have this log filter mostly working, but I can't for the life of me figure out how the 'Prefix' is used.
I've set different values for the Prefix, but it seems to be completely ignored by RunDeck --- all data defaults back to ${data.} that is getting parsed.
For example, if I create a 'Prefix' to the value of 'tenant', does this gets prefixed at the attribute level, such as:
${data.tenant.}
or does this affect the actual exported object:
${tenant.}
Any help or some additional details around how Prefix is used by the Log Filter would be very much appreciated, but as of right now -- RunDeck seems to ignore anything I write into the prefix attribute.
Thanks a bunch! Definitely useful and needed functionality!
Hi guys
Curl responses are usually returned without any linebreaks or spacing. This isn't a problem when using jq via the command line.
However this filter doesn't pick up on values unless the response is "prettified" first. I'm working around this by capturing the response in a variable and running it through jq eg: echo $RESPONSE | jq .
This outputs a prettified response which the filter can work with.
This may also be related to #7. Perhaps the parsing methods used in the filter could be improved so they're more robust?
Hi all
have come up against a bit of a brick wall with this. using the JSON jq key/Value mapper to grab variables in a job and it's working great. the only snaffoo is that for some of our values have spaces in them... which means when we try to call them ${data.some thing} we can't
Anyone have any ideas?
Thanks
Rich
Running jq directly the following example gives such result:
java -jar jackson-jq-cli-1.0.0-preview.20210928.jar ".values[].displayId"
{"size":4,"limit":25,"isLastPage":true,"values":[{"id":"refs/heads/release/21.3.1","displayId":"release/21.3.1","type":"BRANCH","latestCommit":"cd1be2db485a7518c60f24d792814e89ba924e6d","latestChangeset":"cd1be2db485a7518c60f24d792814e89ba924e6d","isDefault":false},{"id":"refs/heads/release/21.4.1","displayId":"release/21.4.1","type":"BRANCH","latestCommit":"3f2118816aaa48decdccc7e03bdf8a0bb9726545","latestChangeset":"3f2118816aaa48decdccc7e03bdf8a0bb9726545","isDefault":false},{"id":"refs/heads/release/22.1.1","displayId":"release/22.1.1","type":"BRANCH","latestCommit":"3fb98b205cd2fdfe1466c5f535b309ea882d57c0","latestChangeset":"3fb98b205cd2fdfe1466c5f535b309ea882d57c0","isDefault":false},{"id":"refs/heads/release/22.2.1","displayId":"release/22.2.1","type":"BRANCH","latestCommit":"8e49efb0613e433947d228e756c90333086ec518","latestChangeset":"8e49efb0613e433947d228e756c90333086ec518","isDefault":false}],"start":0}
"release/21.3.1"
"release/21.4.1"
"release/22.1.1"
"release/22.2.1"
when running the same with jq-json-logfilter
I get only the last value instead of four
Hi, I'm testing this plugin and I'm facing a weird behavior, this is my setup:
I'm using ansible to get informations from an API, which send me back json datas.
I'm want to capture them, but always facing this same response:
PLAY [XXXX] ***************************************************************
TASK [XXXX] ****************************************************************ok: [localhost]
TASK [XXXX] **********************************************ok: [localhost]
TASK [XXXX] *************************************************ok: [localhost]
TASK [XXXX] *************************************************************ok: [localhost] =>
{ "aaaaaaa": { "bbbbbb": { "ccccc": [ { "ddddd": { "self": { "href": "https://eeeeeeeeeeeee" } },
"attributes": { "fffffff": "ggggggggg" }, "description": "hhhhhhhhh", "id": 111111, "iiiiii": "112233445566",
"jjjjj": "kkkkkkkkkkk" } ] }, "llllllll": { "zzzzz": { "href": "https://mmmmmmmmmmmmmmmm" } } }}
PLAY RECAP *********************************************************************
localhost : ok=4 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
[error] cannot map the json output: Unrecognized token 'PLAY':
was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false') at [Source: (String)"
I tried with multiple filters which leads to the same things. When trying with debug output it's another word picked up but it still fail.
Did I miss something or is the plugin waiting for a json only output ?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.