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

Authentication on TElasticSearchAppender #82

Open
Basti-Fantasti opened this issue Oct 23, 2023 · 1 comment
Open

Authentication on TElasticSearchAppender #82

Basti-Fantasti opened this issue Oct 23, 2023 · 1 comment
Assignees

Comments

@Basti-Fantasti
Copy link

I've installed an ELK stack using docker on a local VM to play around with ElasticSearch.

The services seem to be up and running and listening on the default ports.
When calling the URL like it is found in the LoggerProConfig unit for the elastic search demo (demo 120)

_RESTAppender := TLoggerProElasticSearchAppender.Create('http://localhost', 9200, 'loggerpro');

There seem to be no option for authentication.
When calling any request from the supplied demo program, this error is thrown:

ExceptionMessage="{"error":{"root_cause":[{"type":"security_exception","reason":"missing authentication credentials for REST request [/loggerpro/_doc]","header":{"WWW-Authenticate":["Basic realm=\"security\" charset=\"UTF-8\"","ApiKey"]}}],"type":"security_exception","reason":"missing authentication credentials for REST request [/loggerpro/_doc]","header":{"WWW-Authenticate":["Basic realm=\"security\" charset=\"UTF-8\"","ApiKey"]}},"status":401}"

When calling the URL directly in a browser or using a rest client like postman an authentication has to be send together with the request.
After a successful authentication, a valid json object is shown:

{
  "name" : "elasticsearch",
  "cluster_name" : "docker-cluster",
  "cluster_uuid" : "Jt7XTXq6Q4q9ydcDFgDrdg",
  "version" : {
    "number" : "8.10.4",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "b4a62ac808e886ff032700c391f45f1408b2538c",
    "build_date" : "2023-10-11T22:04:35.506990650Z",
    "build_snapshot" : false,
    "lucene_version" : "9.7.0",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}

So it there already a way on how to pass the credentials? Or does the authentification module need to be added?

Best regards
Bastian

@Basti-Fantasti
Copy link
Author

I saw, that the ElasticSearch Logger is a child object of the Restful Logger which is missing the authentication modes as well.
Maybe it would be a good idea to implement the standard authentication modes in the base class (Basic auth, Bearer Token, Generic API Key, etc)

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

No branches or pull requests

2 participants