Created
March 3, 2021 09:36
-
-
Save mtmtcode/05c248bb44578dcd153b424c9cbcbd82 to your computer and use it in GitHub Desktop.
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 bash | |
#### | |
# | |
# peco-awslogs | |
# | |
# awslogs getのラッパー。 | |
# AWSのロググループをpecoで絞って取得する。 | |
# | |
# original: https://qiita.com/hiroga/items/2a9a4673f60aca7cc48f | |
set -eo pipefail | |
AWSLOGS_OPTIONS="$@" | |
COMMAND=$1 | |
while [[ $# -gt 0 ]]; do | |
case "$1" in | |
--profile) | |
AWS_PROFILE=$2 | |
shift 2 | |
;; | |
*) | |
shift 1 | |
;; | |
esac | |
done | |
if [[ -z ${AWS_PROFILE} ]]; then | |
AWS_PROFILE_OPTION="" | |
else | |
AWS_PROFILE_OPTION="--profile $AWS_PROFILE" | |
fi | |
GROUP=$(awslogs groups ${AWS_PROFILE_OPTION} | peco) | |
if [[ ${GROUP} = "" ]]; then | |
exit | |
fi | |
awslogs get ${GROUP} ${AWSLOGS_OPTIONS} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment