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!

What You Read The Most: Splunk Lantern’s Most Popular Articles!

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

See your relevant APM services, dashboards, and alerts in one place with the updated ...

As a Splunk Observability user, you have a lot of data you have to manage, prioritize, and troubleshoot on a ...

Index This | What goes away as soon as you talk about it?

May 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this month’s ...