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

Issue with auth, with long periods of idleness #18

Open
brokensound77 opened this issue May 16, 2018 · 0 comments
Open

Issue with auth, with long periods of idleness #18

brokensound77 opened this issue May 16, 2018 · 0 comments

Comments

@brokensound77
Copy link
Owner

Issue when the AlertLogic object is instantiated and long periods of idleness between calls, results in timeout. The call below at the beginning of all Event generation is not complete because it is simply checking against the AlertLogic variable al_logged_in

if self.username is not None and self.password is not None:
    if self.al_logged_in is False:
        self.login_al()

which is only set at login:

def login_al(self):
...
    AlertLogic.al_logged_in = True
        return

Solution to resolve this would be:

AlertLogic:

def check_al_login(self):
    test = AlertLogic.alogic.get('https://console.overview.alertlogic.com/')
    if test.status_code == 200:
        AlertLogic.al_logged_in = True
        return True
    else:
        AlertLogic.failed_auth_reason = 'failed auth: status code: {0}, reason: {1}'.format(test.status_code, test.reason)
        AlertLogic.al_logged_in = False
        return False

Event:

if self.username is not None and self.password is not None:
    if self.check_al_login() is False:
        self.login_al()

The problem is that this adds an additional http call to every single event generated. It is also not thread safe to modify the AlertLogic.al_logged_in variable. Best resolution would be to create a custom threading object and add locks. But this also still needs a threadpool and possibly queuing, so...... maybe one day...

Another kudos to @TheRemover for identifying the timeout issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant