From 5aa4b9b288cdb2ee5914206a667900ec68d20556 Mon Sep 17 00:00:00 2001 From: MrJim <45451777+MrJim-06@users.noreply.github.com> Date: Tue, 22 Feb 2022 11:32:14 +0900 Subject: [PATCH] Update elfCURL_win.sh update elfCURL_win.sh script for using ${access_token} variable --- elfCURL_win.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elfCURL_win.sh b/elfCURL_win.sh index 23ff369..15e9e63 100644 --- a/elfCURL_win.sh +++ b/elfCURL_win.sh @@ -58,7 +58,7 @@ read -p "Please enter logdate (e.g. Yesterday, Last_Week, Last_n_Days:5) (and pr access_token=`curl https://${instance}.salesforce.com/services/oauth2/token -d "grant_type=password" -d "client_id=${client_id}" -d "client_secret=${client_secret}" -d "username=${username}" -d "password=${password}" -H "X-PrettyPrint:1" | jq -r '.access_token'` #set elfs to the result of ELF query -elfs=`curl https://${instance}.salesforce.com/services/data/v48.0/query?q=Select+Id+,+EventType+,+LogDate+From+EventLogFile+Where+LogDate+=+${day} -H 'Authorization: Bearer {AccessToken}' -H "X-PrettyPrint:1"` +elfs=`curl https://${instance}.salesforce.com/services/data/v48.0/query?q=Select+Id+,+EventType+,+LogDate+From+EventLogFile+Where+LogDate+=+${day} -H "Authorization: Bearer ${access_token}" -H "X-PrettyPrint:1"` #set the three variables to the array of Ids, EventTypes, and LogDates which will be used when downloading the files into your directory ids=( $(echo ${elfs} | ./jq -r ".records[].Id" | sed 's/[ \t]*$//') ) @@ -77,5 +77,5 @@ for i in "${!ids[@]}"; do mkdir "${logDates[$i]}" #download files into the logDate directory - curl --compressed "https://${instance}.salesforce.com/services/data/v48.0/sobjects/EventLogFile/${ids[$i]}/LogFile" -H 'Authorization: Bearer {AccessToken}' -H "X-PrettyPrint:1" -o "${logDates[$i]}/${eventTypes[$i]}.csv" + curl --compressed "https://${instance}.salesforce.com/services/data/v48.0/sobjects/EventLogFile/${ids[$i]}/LogFile" -H "Authorization: Bearer ${access_token}" -H "X-PrettyPrint:1" -o "${logDates[$i]}/${eventTypes[$i]}.csv" done