Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

205
Vistas
How to get variable out from the Splunk mvc.createService().get() function?

sorry for posting this, but I need some help and another pair of eyes. I must admit that everything that I have found here on stackoverflow, splunk docs and splunk community answers, and of course tried, it failed on me.

What I want to achieve is to read from a custom config file (file details below) and get that result out to be used in other part of the code for a double check.

Conf file details: name config.conf, the stanza is named download, the property is called version which may have value of new or old.

The code is:

define(["jquery", "react", "splunkjs/mvc", "splunkjs/splunk"], function ($, react, mvc, splunk_js_sdk) {
  
  const e = react.createElement;
  const useEffect = react.useEffect;

  // Get version from conf file
  var version;
  mvc.createService().get("/servicesNS/-/my_app/properties/config/download", {}, function (err, response) {
    if (err) {
      console.log("Error:" + err);
      return;
    } else {
      version = response.data.entry[0].content;
      console.log("Version from conf: " + version);
    }
    return version
  });
...........Rest of the code (React)..........
});

...which works and displays the version in the console.log Version from conf: old inside function, but my real issue (which I am not able to see it) is that I am not able to figure it how to get out that result into a variable, for example:

var version = old

This looks like an asynchronous function with a promise (not sure) but my knowledge (I must admit) is not so great in this area.

I have found my inspiration from here and I have adjusted a bit for my needs.

In the end I am thanking in advance to anyone who will shed a bit of light for me here.

Thank you, George

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda