Created
February 18, 2016 19:53
-
-
Save rjsvaljean/1880957aeeb787a3fdc0 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
| #!/bin/sh | |
| # Requires `jq` | |
| searchLogs() { | |
| USER=$2 | |
| PASSWORD=$3 | |
| ORG=$4 | |
| MSG_ID="$(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "$1")" | |
| RSID=$(curl -s -u $USER:$PASSWORD "https://$ORG.loggly.com/apiv2/search?q=$MSG_ID&from=-9h&until=now&size=30" | jq -r '.rsid.id' 2>/dev/null) | |
| sleep 5 | |
| curl -s -u $USER:$PASSWORD "https://$ORG.loggly.com/apiv2/events?rsid=$RSID" | jq '.events[] | {logMsg: .logmsg, tags: .tags[0]} | '$4; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment