cloudflarearchive / cloudflare-elastic

Apache License 2.0
32 stars 26 forks source link

ClassNotFoundException when forwarding events from S3 to Elastic Cloud #32

Closed abdulrafaykhan closed 2 years ago

abdulrafaykhan commented 2 years ago

Hi,

I've been pulling my hair over this issue however unable to solve it

I am following the Cloudflare's official documentation, linked here

I have added the function to lambda and provided the relevant role. However, while testing the code, I am getting the following error:

{ "errorMessage": "Class not found: com.cloudflare.elastic.ElasticLambdaForwarder", "errorType": "java.lang.ClassNotFoundException" }

I dont know if this is something that is frequent or not

The runtime im using is Java 8 on Amazon Linux 2. I have tried it with AL1 and Java 11 Corretto as well but the same error as there

I am using the following as my handler: com.cloudflare.elastic.ElasticLambdaForwarder::handleRequest

Further, the release Im working with is as follows: https://github.com/cloudflare/cloudflare-elastic/releases/tag/v0.3-7.x

I have been searching for quite a few days and unable to find any solution as of yet :(

abdulrafaykhan commented 2 years ago

@aleph-zero if you can assist with this ? Thank you !!

i have been searching long and hard and unable to find any resolution

yunusemrecatalcam commented 2 years ago

did you figure it out?

abdulrafaykhan commented 2 years ago

Hi,

So for anyone running into this issue in the future.

What actually was happening that the link in the documentation for code for the Lambda function is actually redirecting to the code that first needs to be built through the following command:

./gradlew clean build

You can either build it yourself ( you would need JRE and JDK both ) or use the one of the previous releases for fetching the already built lambda function code here

Further, if you run into this issue later down the line, please ensure the following to start receiving logs into the proper ElasticSearch Index:

Create an index by the name of cloudflare-test through the following request curl -X PUT "localhost:9200/cloudflare-test?pretty"

Download the index templates from the same release i.e.

Issue the following command through terminal from your own computer:

./install-artifacts.sh -u elastic -p -e https://__:9243

After this, you should hopefully see the following output:

Installing ingest pipeline to https://_ for daily indices {"acknowledged":true} Installing ingest pipeline to https:// for weekly indices {"acknowledged":true} Installing index template to https://_ {"acknowledged":true}

After which the logs should start appearing on Kibana