Export GCP Stackdriver Log With Filebeat

This is a bash script to configure GCP project to export logs by creating a Pub/Sub sink topic and let filebeat to subscribe to that sink topic by the filebeat google cloud module. #!/bin/sh # author: me 😃 # $ bash gcloud-admin.sh -h Required parameters: # -id|–project-id: gcloud project id # -svs|–svs-account: gcloud service account name to collect logs # Optional parameters: # -h|–help: Print this message readonly ARGS="$@" readonly dependencies=( "gcloud" ) processArgs(){ while [[ "$#" -gt 0 ]]; do key="$1" case "$key" in -h|–help) PRINT_HELP=true shift ;; -id|–project-id) PROJECT_ID="$2" shift ;; -svs|–svs-account) SVS_ACCOUNT="$2" shift ;; esac shift done } checkDependencies() { local unmet_dependencies=false for dependency in "${dependencies[@]}" ; do command -v "${dependency}" >/dev/null 2>&1 || { echo >&2 "${dependency}required"; unmet_dependencies=true } done if [ "${unmet_dependencies}" = true ] ; then echo "Please install unmet dependencies above before running.
Read more →

amazon s3

aws s3 cli is great! You can easily move your local files to your aws s3 buckets. However, sometimes it is not that easy to do simple tasks - like copy files where there is a whitespace in the file name, delete all versions of all files in a versioned s3 bucket and the difference between aws s3 sync and aws s3 cp –recursive . escape the whitespace in your file name When you have a long list of files that you need to upload to s3 bucket, it will be easy for you to loop it through if you have nice filenames that there are no whitespace.
Read more →