Security

How to use Splunk & NodeJS to establish a connection and pull data from Splunk?

gregory__
Engager

Hi,

My team and I are currently developing a website which needs to pull data from Splunk and insert it into visualizations on the home page on the website. As the title suggests, we are currently using React and NodeJS and due to our absolute lack of Splunk experience we are a bit bogged down so please forgive me if this is a potentially dumb question. 

We are trying to use the Splunk JavaScript SDK in Node to establish a connection and pull data from Splunk. we have tried absolutely everything  at this point but cannot establish a connection and perform a simple service.login through the SDK. We have tried this with postman and it appears to be working just fine on that side of things.

For Example: 

We have tried using the code from Server Side Javascript but when running it, it throws the following error:

 

 

 

 

  throw err;
        ^
{
  response: { headers: {}, statusCode: 600 },
  status: 600,
  data: undefined,
  error: Error: connect ECONNREFUSED ::1:8089
      at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1195:16) {
    errno: -4078,
    code: 'ECONNREFUSED',
    syscall: 'connect',
    address: '::1',
    port: 8089
  }
}

Node.js v17.9.0

 

 

 

 

 

 

 

 OR this error

 

 

 

 

 

 

 

        throw err;
        ^
{
  response: { headers: {}, statusCode: 600 },
  status: 600,
  data: undefined,
  error: Error: write EPROTO 04490000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:355:

      at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:94:16) {
    errno: -4046,
    code: 'EPROTO',
    syscall: 'write'
  }
}

Node.js v17.9.0

 

 

 

 

 

 

 

 

Can anyone please help? Any help would be greatly appreciated

Labels (1)
0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@gregory__ 

In this kind of use case I would like to suggest my favourite architecture.

Please go through below pic and let me know if you need more of this.

Screenshot 2022-06-13 at 6.51.26 PM.png

Thanks
KV


If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.

 

 

Get Updates on the Splunk Community!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...