This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| function fetchlogs { | |
| if [ $1 = "kibana" ]; then | |
| _container="-c kibana" | |
| else | |
| _container="" | |
| fi | |
| for i in $(oc get pods --output=name -l component=$1 | sed 's|pod/||') ; do oc logs $i $_container > $i.$2.log ; done | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| _BASE=/etc/kibana/keys | |
| _CA=$_BASE/ca | |
| _CERT=$_BASE/cert | |
| _KEY=$_BASE/key | |
| ls -l $_CA $_CERT $_KEY | |
| _USER=foo | |
| _TOKEN=bar |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| ES_URL='https://localhost:9200' | |
| curl_get='curl -s -X GET --cacert /etc/elasticsearch/secret/admin-ca --cert /etc/elasticsearch/secret/admin-cert --key /etc/elasticsearch/secret/admin-key' | |
| date | |
| $curl_get $ES_URL/_cat/health?v | |
| $curl_get $ES_URL/_cat/nodes?v | |
| $curl_get $ES_URL/_cat/indices?v 2>&1 | grep -vE "^green" | |
| $curl_get $ES_URL/_cat/indices?v 2>&1 | grep "searchguard" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| _BASE=/etc/kibana/keys | |
| _CA=$_BASE/ca | |
| _CERT=$_BASE/cert | |
| _KEY=$_BASE/key | |
| ls -l $_CA $_CERT $_KEY | |
| ES_URL='https://logging-es:9200' | |
| curl_get="curl -X GET --cacert $_CA --cert $_CERT --key $_KEY" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # Use via: curl -X GET http://localhost:9200/_cluster/health?level=indices | |
| import sys, json | |
| #json_doc = json.load(open(sys.argv[1])) | |
| json_doc = json.load(sys.stdin) | |
| #json.dump(json_doc, sys.stdout, indent=4, sort_keys=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # Use via: curl -X GET http://localhost:9200/_all/_settings?pretty | |
| import sys, json | |
| #json_doc = json.load(open(sys.argv[1])) | |
| json_doc = json.load(sys.stdin) | |
| #json.dump(json_doc, sys.stdout, indent=4, sort_keys=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import os, sys, json | |
| lines = [] | |
| for fn in sys.argv[1:]: | |
| with open(fn, "r") as fp: | |
| line_count = 0 | |
| for line in fp.readlines(): | |
| line_doc = json.loads(line) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # Use via: curl -X GET http://localhost:9200/<index>/_search/?fields=@timestamp,level,hostname,kubernetes.host,kubernetes.pod_name,kubernetes.container_name,message&q=message:<string> | |
| import sys, os, json | |
| if len(sys.argv) == 1 or sys.argv[1] == '-': | |
| json_doc = json.load(sys.stdin) | |
| else: | |
| json_doc = json.load(open(sys.argv[1])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| > We certainly don't want to log all that with every message. Given that | |
| > UUID is UU, can't that be squirreled away in a lookup table somewhere else | |
| > out of the fast path? | |
| Unfortunately, it seems we have a clash of two valid concerns with logging: | |
| 1. efficiency: How do emit logs efficiently such that the process of emitting, collecting, and shipping them off does not over-burden the environment making it unusable | |
| 1. utility: How do we include sufficient metadata surrounding the logs so that they are useful when a entity consumes them | |
| These are age-old trade-offs that we are discussing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| seeded_state = UNSEEDED; | |
| lock = Lock(); | |
| syncing = Sync(); | |
| process() { | |
| if (seeded_state == SEEDED) { | |
| continue; | |
| } else { | |
| lock.lock(); | |
| try { |