-
Notifications
You must be signed in to change notification settings - Fork 80
updated missing api endpoint argument #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ciaran-finnegan
wants to merge
3
commits into
SumoLogic:master
Choose a base branch
from
ciaran-finnegan:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Submits search job, waits for completion, then prints and emails _messages_ | ||
# (as opposed to records). Pass the query via stdin. | ||
# | ||
# python search-job-messages.py <accessId> <accessKey> <fromDate> <toDate> <timeZone> <byReceiptTime> | ||
# | ||
# Note: fromDate and toDate must be either ISO 8601 date-times or epoch | ||
# milliseconds | ||
# | ||
# Example: | ||
# | ||
# cat python search-job-messages.py <accessId> <accessKey> 1408643380441 1408649380441 PST false | ||
|
||
import json | ||
import sys | ||
import time | ||
|
||
from sumologic import SumoLogic | ||
|
||
# limit may not be necessary (Ciaran) | ||
LIMIT = 1000000 | ||
|
||
args = sys.argv | ||
sumo = SumoLogic(args[1], args[2], args[3]) | ||
fromTime = args[4] | ||
toTime = args[5] | ||
timeZone = args[6] | ||
byReceiptTime = args[7] | ||
|
||
delay = 5 | ||
|
||
q = '_sourceCategory = zeus/trend | where signature_id >= 4000000 AND signature_id <= 4999999 | timeslice 30m | count _timeslice, Action | transpose row _timeslice column Action' | ||
|
||
sj = sumo.search_job(q, fromTime, toTime, timeZone, byReceiptTime) | ||
|
||
status = sumo.search_job_status(sj) | ||
while status['state'] != 'DONE GATHERING RESULTS': | ||
if status['state'] == 'CANCELLED': | ||
break | ||
time.sleep(delay) | ||
status = sumo.search_job_status(sj) | ||
|
||
print(status['state']) | ||
|
||
if status['state'] == 'DONE GATHERING RESULTS': | ||
count = status['messageCount'] | ||
limit = count if count < LIMIT and count != 0 else LIMIT # may not be necessary (Ciaran) | ||
r = sumo.search_job_messages(sj, limit=limit) | ||
print(r) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,29 @@ | ||
# Submits search job, waits for completion, then prints and emails _messages_ | ||
# (as opposed to records). Pass the query via stdin. | ||
# | ||
# cat query.sumoql | python search-job-messages.py <accessId> <accessKey> \ | ||
# <fromDate> <toDate> <timeZone> <byReceiptTime> | ||
# cat query.sumoql | python search-job-messages.py <accessId> <accessKey> <fromDate> <toDate> <timeZone> <byReceiptTime> | ||
# | ||
# Note: fromDate and toDate must be either ISO 8601 date-times or epoch | ||
# milliseconds | ||
# | ||
# Example: | ||
# | ||
# cat query.sumoql | python search-job-messages.py <accessId> <accessKey> \ | ||
# 1408643380441 1408649380441 PST false | ||
# cat query.sumoql | python search-job-messages.py <accessId> <accessKey> 1408643380441 1408649380441 PST false | ||
|
||
import json | ||
import sys | ||
import time | ||
|
||
from sumologic import SumoLogic | ||
|
||
LIMIT = 42 | ||
LIMIT = 1000000 | ||
|
||
args = sys.argv | ||
sumo = SumoLogic(args[1], args[2]) | ||
fromTime = args[3] | ||
toTime = args[4] | ||
timeZone = args[5] | ||
byReceiptTime = args[6] | ||
sumo = SumoLogic(args[1], args[2], args[3]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason you require the endpoint here? |
||
fromTime = args[4] | ||
toTime = args[5] | ||
timeZone = args[6] | ||
byReceiptTime = args[7] | ||
|
||
delay = 5 | ||
q = ' '.join(sys.stdin.readlines()) | ||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script seems specific, so would be great to explain what it does more explicitly.