Skip to content
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

saved search added and tested #5

Open
wants to merge 10 commits into
base: master
from

finished saved search, but not tested yet

  • Loading branch information
mnuyens committed Jun 5, 2012
commit 145b13946c5753414f145b416ee69a096e1ebd91
@@ -16,7 +16,7 @@
class LogglySession(object):
domain = 'loggly.com'
proxy = 'logs.loggly.com'

ssdict={'order':'order','from':'starttime','rows':'rows','until':'endtime',
def __init__(self, subdomain, username, password, domain=None, proxy=None,
secure=True):
'''pass in subdomain, username, and password to authorize all API
@@ -118,6 +118,24 @@ def savedsearch(self,q="",**_kwargs):
if saved==None:
raise ValueError("Your account does not have a search of that name,\
please go to "+self.subdomain+".loggly.com to check your saved searches")
params=saved['context']
opts={}
inputs=""
devices=""
for x in params:
if x!="content" and x!="inputs" and x!="devices":
opts[ssdict[x]]=params[x]
if params['inputs']:
inputs+=" AND (inputname:"+params['inputs'][0]
for x in params['inputs'].__iter__().next():
inputs+=" OR inputname:"+x
inputs+=")"
if params['devices']:
devices+=" AND (ip:"+params['devices'][0]
for x in params['devices'].__iter__().next():
devices+=" OR ip:"+x
devices+=")"
return self.search(q=params['terms']+inputs+devices,**opts)



ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.