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!

Community Content Calendar, November Edition

Welcome to the November edition of our Community Spotlight! Each month, we dive into the Splunk Community to ...

October Community Champions: A Shoutout to Our Contributors!

As October comes to a close, we want to take a moment to celebrate the people who make the Splunk Community ...

Stay Connected: Your Guide to November Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...