Skip to main content
Want the ultimate Splunk learning experience? Head to Boston a few days before .Conf25 to attend Splunk University!

 

Splunk Lantern

Node.js deprecation FAQ

 

  1. Why is Splunk deprecating Node.js?
    Splunk is reallocating engineering resources from maintaining Node.js to other priorities, given that there is limited Node.js usage.

  2. What version of the Splunk platform is Node.js deprecated from?
    Node.js is deprecated as of Splunk Cloud Platform version 10.0.2503 and Splunk Enterprise 10.0.

  3. What version of the Splunk platform will Node.js be removed from?
    We expect to remove Node.js in the next Splunk Cloud Platform and Splunk Enterprise releases.

  4. What will happen when Node.js is removed?
    There should be no changes to Splunk platform functionality. However, if you are using any apps with a dependency on Node.js, you will likely see some broken functionality.

  5. What do I do if I use a Splunkbase app that depends on Node.js?
    Contact the app developer to release a new version of the app which removes the dependency on Node.js bundled in the Splunk platform.

  6. What will happen if I don't update my apps dependent on Node.js?
    If you don't update apps that are dependent on Node.js, you might experience app or TA functionality degradation and unexpected behavior.

  7. What if I'm an app developer and my app depends on Node.js?
    Update your app to bundle Node.js. If you are building private apps, you can also install Node.js into your system and update your app to reference your installed Node.js.

  8. How do I bundle Node.js into my app?
    To run Node.js that is bundled with an app, you will first need to bundle Node.js for each OS that you plan to support. For example, if your app plans to support the Linux x86_64 and Windows x86_64 architectures, ensure your app has two folders in the following paths:

    $SPLUNK_HOME/<app_name>/linux_x86_64
    $SPLUNK_HOME/<app_name>/windows_x86_64

    You can then bundle Node.js inside the OS-specific directory. For example:

    $SPLUNK_HOME/<app_name>/linux_x86_64/bin/node
    $SPLUNK_HOME/<app_name>/windows_x86_64/bin/node.exe
  9. How do I use Node.js installed in the Splunk platform?
    To run apps using a Node.js that is installed in the system, app consumers need to ensure that Node.js is in the system’s path variable so that the command node opens the Node.js interpreter.

    Alternatively, you can ask app consumers to set a NODE_HOME environment variable that corresponds to the directory where their Node.js binary lives. They can set NODE_HOME in their environment variables or in $SPLUNK_HOME/etc/splunk-launch.conf.

    To set up environment variables, customers need to run this command in Linux before launching the Splunk platform:

    Unset
    export NODE_HOME = <path_to_node_directory>
    $SPLUNK_HOME/bin/splunk restart
    

    Alternatively, app consumers can add the environment variable by editing $SPLUNK_HOME/etc/splunk-launch.conf to include the following line:

    Unset
    # In $SPLUNK_HOME/etc/splunk-launch.conf
    NODE_HOME=<path_to_directory_containing_system_installed_node>
    
  10. How do I migrate my existing custom functionality?
    After ensuring that Node.js is bundled with the app or that app consumers have it installed in the system, you can create a wrapper script to call your JavaScript file.

    In Linux, you can create a custom_command.sh script:

    Unset
    #!/usr/bin/env sh
    current_dir=$(dirname "$0")
    NODE_CMD=node
    if [ ! -z "$NODE_HOME" ]; then
    NODE_CMD="$NODE_HOME/bin/node"
    fi
    exec $NODE_CMD "$current_dir/<script_name>.js" $@
    

    In Windows, you can also create a custom_command.bat script:

    Unset
    @echo off
    set NODE_CMD=node.exe
    if EXIST %NODE_HOME%\node.exe (
    set NODE_CMD=%NODE_HOME%\node.exe
    )
    @"%NODE_CMD%" "%~dp0\<script_name>.js" %*
    

    The location to store these scripts depends on the type of custom functionality you are using:

    • For custom scripted inputs, the wrapper scripts should be placed under the $SPLUNK_HOME/<app_name>/bin directory.
    • For custom alert actions, custom modular inputs, and custom search commands, the wrapper scripts should be placed under the $SPLUNK_HOME/<app_name>/linux_x86_64/bin and/or $SPLUNK_HOME/<app_name>/windows_x86_64/bin directories.
    • For custom search commands, you might need to create a command.path file for every OS that your app supports that specifies where to find your wrapper script, for example:
      Unset
      $SPLUNK_HOME/etc/apps/<app_name>/linux_x86_64/bin/command.sh
      
      This command.path file should be placed under the the OS-specific directory such as $SPLUNK_HOME/<app_name>/linux_x86_64/bin/command.path and/or $SPLUNK_HOME/<app_name>/windows_x86_64/bin/command.path.