Skip to content

Instantly share code, notes, and snippets.

View michael-adam-sheehan's full-sized avatar

Mike Sheehan michael-adam-sheehan

View GitHub Profile
@michael-adam-sheehan
michael-adam-sheehan / sfdc-errorlogextract-traceflag
Created August 18, 2020 06:11
SFDC Errorlog Extract TraceFlag
# initial traceflag setting
body = {
'StartDate': f"{startDate}",
'ExpirationDate': f"{expiryDate}",
'ApexCode': 'FINEST',
'ApexProfiling': 'FINEST',
'Callout': 'FINEST',
'Database': 'FINEST',
'DebugLevelId': debugLevelId,
'System': 'FINE',
@michael-adam-sheehan
michael-adam-sheehan / gist:66e7a32aae5b237e662a381c40aa44f3
Created August 18, 2020 06:14
sfdc-errorlog-extraction-deletion
def delete(self):
print(f"Deleting logs from instance...")
if self.apexLogIds:
logIdsCsvFile = f"{self._logdir}/apex-logids.csv"
with open(logIdsCsvFile, 'w') as csvwriter_file:
csvwriter = csv.writer(csvwriter_file)
csvwriter.writerow(['Id'])
for id in self.apexLogIds:
csvwriter.writerow([id])
@michael-adam-sheehan
michael-adam-sheehan / sfdc-errorlogextract-dockerfile
Created August 18, 2020 06:16
sfdc errorlog extract dockerfile
FROM node:dubnium-alpine3.10
ARG TARGET_USERNAME
ARG SFDX_AUTH_URL
WORKDIR /app
RUN apk update
RUN apk add --no-cache \
bash \
def getChangeSetStatus(self):
hourlyTimestamp = datetime.fromtimestamp(datetime.utcnow().timestamp() - (3600 * 6))
dtFormat = '%Y-%m-%dT%H:%M:%S-00:00%z'
query = f"SELECT EventType, LogDate, LogFileFieldNames, LogFile, Interval FROM EventLogFile WHERE EventType='ChangeSetOperation' AND Interval='Hourly' AND LogDate >= {hourlyTimestamp.strftime(dtFormat)}"
url = f"{self._auth['instanceUrl']}/services/data/v{apiVersion}/query/?q={quote_plus(query)}"
eventTypeLogResult = self._client.request('GET', url).json()
for result in eventTypeLogResult['records']: