-
Notifications
You must be signed in to change notification settings - Fork 66
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
Send cookie to GET method from POST #100
Comments
The HTTP Poller input doesn't support making a chain of requests that rely on each other, which doesn't make it particularly well-suited for cookie-based authentication described above. Does the API you're connecting to support key-based authentication, or HTTP Basic Auth? If so, it would be much simpler to implement since a single request could authenticate the user and retrieve the data. The Manticore client that this plugin uses is theoretically capable of holding onto offered cookies and injecting them into subsequent requests, but because we don't have ordering guarantees, we can't ensure that the "authorization" request to acquire the cookie is made before the "data" request. A pipeline that did so would look something like the following. If the "data" request ran before the first "authentication" request, it would likely error out with
|
Thank you for answer. Unfortunatelly I don't know about this:
I tried a code that you showed but it is not working: nothing showing in logstash. I am trying to do it with a python script. For now I have a such logstash.conf
and python script is:
If you have any idea or a tip I will listen attentively. Thanks |
What do the Logstash logs have to say? Do you have debug logging enabled (e.g.,
Debugging your python script is well out of scope of an issue on the HTTP Poller Input Plugin, and would be better suited as a topic in the Logstash Forums. |
Hi, I'm in the exact same situation than @maksymsereda. I have to make a POST (like to /login) on a web app for getting a cookie and I want to keep this cookie for as long as it's valid and use it for GET requests (like to /health). As soon as there's a 401 error (so the cookie is not valid anymore), I want to to get a new cookie and use it from now on... @yaauie Does the plugin now support making a chain of requests that rely on each other? If not, is it planned soon? @maksymsereda Have you find a stable solution? I also made a python script printing a JSON text, but I'm now wondering how to parse the JSON for Logstash? Thanks. |
My logstash configuration solution.
|
Trying to make a POST method to login and automatically send Cookie to GET method (re-authenticate periodically to fetch a new cookie and then use that in you second request), but smth is going wrong. To make a login I have to fill "login" and "password" poles which is in JSON like this
and URL like this
http://localhost:8080/api/ses/login
My logstash.conf is
Using CentOS 7, ELK Stack 6.3
The text was updated successfully, but these errors were encountered: