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

pcp2elasticsearch accesses a deprecated/removed API endpoint #1998

Open
jtrokel opened this issue Jun 7, 2024 · 0 comments
Open

pcp2elasticsearch accesses a deprecated/removed API endpoint #1998

jtrokel opened this issue Jun 7, 2024 · 0 comments

Comments

@jtrokel
Copy link

jtrokel commented Jun 7, 2024

I am trying to use pcp2elasticsearch-5.2.5 to send PCP logs to an Elasticsearch-8.12.2 instance. However, trying to run it out of the box fails to upload anything to Elasticsearch but does not show any errors. Editing the source code for this program to add a few debugging print statements shows that a POST request is being made to /pcp/pcp-metric. Using cURL to send a POST request constructed the same way gives back an error:

$ curl -i -X POST <es-server>/pcp/pcp-metric
    
  HTTP/1.1 400 Bad Request
  X-elastic-product: Elasticsearch
  content-type: application/json
  content-length: 72

  {"error":"no handler found for uri [/pcp/pcp-metric] and method [POST]"}

I could not find anything in the Elasticsearch API reference about an endpoint of the form /{index}/{type}, which is what this seems to be based on the .py source code. However, the API reference for Elasticsearch version 6.x and older shows that this was the correct endpoint to insert a document into an index. The reference page for 8.x (current) Elasticsearch lists a new endpoint along with the link removal of mapping types, which explains that mapping types were slated to be removed in 5.x and have been phased out until their full removal in 8.x. However, pcp2elasticsearch seems to still rely on them.

Sending a cURL POST request to the current endpoint works as expected:

$ curl -i -X POST <es-server>/pcp/_doc
    
  HTTP/1.1 201 Created
  Location: /pcp/_doc/Q21s9I8BuerNNLwI2fY5
  X-elastic-product: Elasticsearch
  content-type: application/json
  content-length: 158

  {"_index":"pcp","_id":"Q21s9I8BuerNNLwI2fY5","_version":1,"result":"created","_shards":{"total":2,"successful":2,"failed":0},"_seq_no":4329,"_primary_term":1}

Changing the pcp2elasticsearch source code to use this updated endpoint also seems to fix the program, but the logic of it may rely on mapping types more deeply - I didn't spend very much time looking at it.

I am aware that there are more recent versions of PCP than 5.2.5 available which have updates to pcp2elasticsearch; however, these updates fix other problems. The current source code at pcp/src/pcp2elasticsearch/pcp2elasticsearch.py still uses the removed endpoint.

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