Skip to content

Commit 3af3c5d

Browse files
committed
test
1 parent b331d0e commit 3af3c5d

File tree

1 file changed

+5
-1
lines changed
  • .github/actions/log_to_splunk

1 file changed

+5
-1
lines changed

.github/actions/log_to_splunk/main.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def main():
109109
logfile = open(os.path.join(os.path.dirname(os.path.abspath(__file__)), name.replace('./','')),'r')
110110
Lines = logfile.readlines()
111111
for line in Lines:
112-
print(line)
112+
# print(line)
113113

114114
if line:
115115
count+=1
@@ -128,19 +128,23 @@ def main():
128128
x=x.strip()
129129
job_name=re.search("\/\d+\_(?P<job>.*)\.txt",name)
130130
job_name=job_name.group('job')
131+
print(f"Job name: {job_name}")
131132
fields = {'lineNumber':count,'workflowID':GITHUB_WORKFLOWID,'job':job_name}
132133
if x:
133134
batch+=1
134135
event={'event':x,'sourcetype':SPLUNK_SOURCETYPE,'source':SPLUNK_SOURCE,'host':host,'time':timestamp,'fields':fields}
135136
eventBatch=eventBatch+json.dumps(event)
137+
print(f"eventBatch: {eventBatch}")
136138
else:
137139
print("skipped line "+str(count))
138140

139141
if batch>=1000:
142+
print("batch>=1000")
140143
batch=0
141144
x=requests.post(SPLUNK_HEC_URL, data=eventBatch, headers=headers)
142145
eventBatch=""
143146

147+
print("here?")
144148
x=requests.post(SPLUNK_HEC_URL, data=eventBatch, headers=headers)
145149

146150
if __name__ == '__main__':

0 commit comments

Comments
 (0)