Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add utility to make it easier to get stuff from es #337

Merged
merged 1 commit into from
Feb 24, 2017

Conversation

jcantrill
Copy link
Contributor

Simplifies getting project index data from es. Call like:

oc exec POD -- bash es_util

I don't know how to pass ENV vars with the command so the only way to change any of them would be to provide actual args. Suggestions?

@jcantrill
Copy link
Contributor Author

[test]

@jcantrill
Copy link
Contributor Author

can pass ENV vars like:

oc exec logging-es-hhy11s1c-5-gh6kq -- bash -c "INDEX=.operations.* es_util"

SIZE=${SIZE:-10}
SORT=${SORT:-"@timestamp:desc"}

BASE=https://logging-es:9200
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BASE=${BASE:-https://localhost:9200}
since you are running this inside the same pod that ES is running, you can use localhost.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@@ -0,0 +1,19 @@
#/bin/bash -x
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggest -euxo pipefail


BASE=https://logging-es:9200

if [ -z $QUERY ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"${QUERY:-}" when using -u.


URL="$BASE/$INDEX"

curl -s -k --cert /etc/elasticsearch/secret/admin-cert --key /etc/elasticsearch/secret/admin-key $URL | python -mjson.tool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do you use $QUERY?

BASE=https://logging-es:9200

if [ -z $QUERY ]; then
QUERY="$INDEX/_search?size=$SIZE\&sort=$SORT"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want $INDEX in $QUERY?

@ewolinetz
Copy link
Contributor

would it be easier if we just created an alias for the curl and cert info? and then a user would still -XGET 'https://localhost:9200/....' and such

@jcantrill
Copy link
Contributor Author

@ewolinetz I'm not sure I understand what you are suggesting.

@openshift-bot
Copy link

Evaluated for aggregated logging test up to 7acb01d

@jcantrill
Copy link
Contributor Author

@richm updated to address your comments

@openshift-bot
Copy link

Aggregated Logging Test Results: SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test-origin-aggregated-logging/1184/) (Base Commit: 0bdc7e5)

@richm
Copy link
Contributor

richm commented Feb 24, 2017

[merge]

@openshift-bot
Copy link

Evaluated for aggregated logging merge up to 7acb01d

@openshift-bot
Copy link

openshift-bot commented Feb 24, 2017

Aggregated Logging Merge Results: SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test-origin-aggregated-logging/1185/) (Base Commit: 0bdc7e5)

@openshift-bot openshift-bot merged commit 0f79b25 into openshift:master Feb 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants