Skip to content

Instantly share code, notes, and snippets.

@Schlump
Schlump / awslogzf
Created September 20, 2022 12:15 — forked from arashilmg/awslogzf
AWSLogs fuzzyfinder (realtime and past)
function awslogzf() {
local PROFILE=`cat ~/.aws/credentials | egrep "\[" | sed "s/\[\(.*\)\]/\1/" | fzf `;
local GROUP=`awslogs groups --profile $PROFILE | fzf `;
local SELECTTIEM=`echo -e "realtime\npast" | fzf +m`;
if [[ $SELECTTIEM == "realtime" ]]; then
local TIMESPAN="-w" ;
else
local MINSAGO=$(for i in `seq 10 10 10080`; do echo $i "->" $(date -d -${i}min) ; done | fzf --prompt="10minutes from: "| tr "\t" " " | tr -s " " | cut -d " " -f1 | sort -n | sed -e 1b -e '$!d');
local FROM=`echo $MINSAGO | cut -d " " -f2 `
local TILL=`echo $MINSAGO | cut -d " " -f1 `