Skip to content

Commit cf6bdf1

Browse files
committed
Update main.py
1 parent 7073845 commit cf6bdf1

File tree

1 file changed

+4
-2
lines changed
  • .github/actions/log_to_splunk

1 file changed

+4
-2
lines changed

.github/actions/log_to_splunk/main.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ def main():
6161

6262
summary.pop('head_repository')
6363

64-
print(summary)
64+
event={'event':json.dumps(summary),'sourcetype':SPLUNK_SOURCETYPE,'source':'workflow_sumary','host':host,'time':summary["updated_at"]}
65+
event=json.dumps(event)
66+
67+
x=requests.post(SPLUNK_HEC_URL, data=event, headers=headers)
6568

6669

6770
url = "{url}/repos/{repo}/actions/runs/{run_id}/logs".format(url=GITHUB_API_URL,repo=GITHUB_REPOSITORY,run_id=GITHUB_WORKFLOWID)
@@ -94,7 +97,6 @@ def main():
9497
z = zipfile.ZipFile(io.BytesIO(x.content))
9598
z.extractall('/app')
9699

97-
headers = {"Authorization": "Splunk "+SPLUNK_HEC_TOKEN}
98100
timestamp = batch = count = 0
99101

100102
for name in glob.glob('/app/*.txt'):

0 commit comments

Comments
 (0)