Developing for Splunk Enterprise

How to create a Symbolic link between React app and Splunk using Yarn?

POR160893
Contributor

Hi,

I am creating a React app and need to create a symbolic link with Splunk using yarn run link:app.

Currently, I am using getting the following permissions issue:

POR160893_0-1653230947621.png



Can you please help?

Labels (1)
0 Karma

PickleRick
Ultra Champion

Firstly, try to paste the results as text (in code block or preformatted text) - it's easier to read and reply to.

Secondly - well, it's your environment, so we have no idea what user you're using, what are his group memberships, what are the permissions for your splunk installation and so on.

And thirdly - if you're building an internal app for unix-based systems only, symlinks may be ok (I'm not sure however how the deployment server would handle them so be wary here). But if you're building an app which could be deployed to windows systems - don't use symlinks.

POR160893
Contributor

Here is the message in text format:

[por160893@por-VM MyTodoList]$ cd packages/my-todo-app
[por160893@por-VM my-todo-app]$ export SPLUNK_HOME=/opt/splunk
[por160893@por-VM my-todo-app]$ export PATH=$SPLUNK_HOME/bin:$PATH
[por160893@por-VM my-todo-app]$ yarn run link:app
node: error while loading shared libraries: libcrypto.so.1.0.0: cannot open shar ed object file: No such file or directory
[por160893@por-VM my-todo-app]$ export LD_LIBRARY_PATH=/opt/splunk/lib
[por160893@por-VM my-todo-app]$ yarn run link:app
yarn run v1.22.18
$ ln -s $PWD/stage $SPLUNK_HOME/etc/apps/my-todo-app
ln: failed to create symbolic link '/opt/splunk/etc/apps/my-todo-app': Permissio n denied
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this comm and.

0 Karma

POR160893
Contributor

This is what I am getting:

POR160893_0-1653235421218.png

 

0 Karma

POR160893
Contributor

How can I check the permissions of the Splunk installation?

0 Karma

PickleRick
Ultra Champion

Just your typical "ls -la" for example. See some unix shell primer if you're not used to manipulating files and directories

POR160893
Contributor

So, when I ran 
[por160893@por-VM my-todo-app]$ yarn run link:app
yarn run v1.22.18
$ ln -s $PWD/stage $SPLUNK_HOME/etc/apps/my-todo-app
ln: failed to create symbolic link '/opt/splunk/etc/apps/my-todo-app': Permission denied
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Next, when I check the permissions on the diretcory /opt/splunk/etc/apps, I got the following::
drwxr-xr-x. 27 10777 10777 4096 Mar 24 01:34 .
drwxr-xr-x. 16 10777 10777 4096 May 18 20:34 ..
drwxr-xr-x. 7 10777 10777 79 Mar 24 01:33 alert_logevent
drwxr-xr-x. 7 10777 10777 79 Mar 24 01:33 alert_webhook
drwxr-xr-x. 4 10777 10777 37 Mar 24 01:33 appsbrowser
drwxr-xr-x. 4 10777 10777 32 Mar 24 01:33 introspection_generator_addon
drwxr-xr-x. 5 10777 10777 46 Mar 24 01:33 journald_input
drwxr-xr-x. 6 10777 10777 68 Mar 24 01:33 launcher
drwxr-xr-x. 5 10777 10777 50 May 18 20:33 learned
drwxr-xr-x. 3 10777 10777 21 Mar 24 01:33 legacy
drwxr-xr-x. 7 10777 10777 96 Mar 24 01:34 python_upgrade_readiness_app
drwxr-xr-x. 6 10777 10777 66 Mar 24 01:33 sample_app
drwxr-xr-x. 9 10777 10777 109 Mar 24 01:33 search
drwxr-xr-x. 6 10777 10777 64 May 18 21:17 splunk_archiver
drwxr-xr-x. 8 10777 10777 145 May 18 20:33 splunk-dashboard-studio
drwxr-xr-x. 7 10777 10777 79 May 25 2021 splunk_essentials_8_2
drwxr-xr-x. 4 10777 10777 37 Mar 24 01:33 SplunkForwarder
drwxr-xr-x. 7 10777 10777 130 Mar 24 01:34 splunk_gdi
drwxr-xr-x. 3 10777 10777 21 Mar 24 01:33 splunk_httpinput
drwxr-xr-x. 9 10777 10777 106 May 18 20:34 splunk_instrumentation
drwxr-xr-x. 3 10777 10777 21 Mar 24 01:33 splunk_internal_metrics
drwxr-xr-x. 4 10777 10777 37 Mar 24 01:33 SplunkLightForwarder
drwxr-xr-x. 8 10777 10777 96 Mar 24 01:34 splunk_metrics_workspace
drwxr-xr-x. 12 10777 10777 154 May 18 20:34 splunk_monitoring_console
drwxr-xr-x. 9 10777 10777 178 Mar 24 01:34 splunk_rapid_diag
drwxr-xr-x. 10 10777 10777 157 Aug 10 2021 splunk_secure_gateway
drwxr-xr-x. 4 10777 10777 37 Mar 24 01:33 user-prefs



0 Karma

PickleRick
Ultra Champion

That means that someone did the install under some non-existant user on your system.

We can't tell you what to do with that since we don't know what user your splunk instance runs under, whether there are some additional conditions and constraints.

0 Karma

POR160893
Contributor

Also, when I checked the owner I received the following:

[por160893@por-VM apps]$ ps aux | grep Splunk
por1608+ 3540 0.0 0.0 221924 1180 pts/0 S+ 17:39 0:00 grep --color=auto Splunk

0 Karma

POR160893
Contributor

Hey,

So, I am working off an Azure VM where I am doing all this work with the Splunk and React. 
Specifically, I have installed Splunk on /opt/splunk and I have 2 React packages on /MyTodoList.

I own this VM, so there should be no permission issue.
All of this work is in conjunction with the following tutorial: https://splunkui.splunk.com/Create/ComponentTutorial

So, my question is, did I install Splunk incorrectly and that is why I cannot perform the yarn run link:app or what information/permissions do I need to solve this issue please?


I appreciate any help you can give!

Thanks

0 Karma

PickleRick
Ultra Champion

To be fully honest with you - it seems that you don't have much experience in administering anything in unix environment. Please try to learn a bit before you start developing anything - otherwise you simply won't understand what you're doing.

I don't know how you installed the splunk package or even which package you installed, what you did or didn't do. It's hard to say. I could advise you to do this or that based on my hunch and experience but it will most probably only generate more problems for you later.

0 Karma