Monitoring Splunk

Can run splunkd in foreground?

hochit
Path Finder

Some integration reason I need to run application in foreground by another agent in my company.
Is it a way to run Splunk in foreground?

Tags (1)
1 Solution

amrit
Splunk Employee
Splunk Employee

Easy: splunk start splunkd --nodaemon

View solution in original post

amrit
Splunk Employee
Splunk Employee

Easy: splunk start splunkd --nodaemon

jrodman
Splunk Employee
Splunk Employee

I downvoted this post because this is not an advisable recommendation for production use.

0 Karma

corydodt
Engager

But why not?

This should be the best-supported way to run splunk. All standard linux pid-1 inits work better with foreground processes because it's easy to detect when the process has exited. You have to go to considerable trouble to make them monitor background processes correctly.

I'm still getting over the fact that splunk doesn't actually ship with any sysvinit-style (or upstart or sysctld...) init scripts.

0 Karma

luhadia_aditya
Path Finder

How stable splunkd is in foreground. As such there is no official documentation stating this parameter.

I have faced such scenarios, if you may suggest something -
https://answers.splunk.com/answers/189019/why-splunkd-is-exiting-with-retrun-code-2-when-run.html

0 Karma

jrodman
Splunk Employee
Splunk Employee

Indeed, --nodaemon involves a few changes in behavior, such as not changing the current directory (to /), which means the current directory of splunkd will be whatever you launched it with, safe or not. You won't be happy if you unmount the filesystem splunkd has as a current directory, for example.

We also do not QA splunkd with this flag. It's intended for testing, troubleshooting and development.

0 Karma

hochit
Path Finder

I asked splunk support. Nothing we can do about this.

0 Karma

hovu96-deactiva
Explorer

Did you find a solution or workaround to do this?

0 Karma

Linegod
Path Finder

You're really not explaining why you want to run it in the foreground. What is the actual problem you are attempting to solve, that you think having splunkd in the foreground would help?

Linegod
Path Finder

Are you sure the application management agent cannot accept the fact that the app goes into daemon mode on its own, and simply issue the 'restart' option if the process dies?

0 Karma

hochit
Path Finder

There's a application management agent from my company that would start/stop app and monitor the process status actively. They're using it to run application into background mode. As I know if Splunk is in background already, somehow it would lose control of the process.

0 Karma

hochit
Path Finder

Nothing special actually. I just want to know if I can run Splunk in foreground instead of daemon. Like most of the other applications that we can make the choice

0 Karma

MHibbin
Influencer

Perhaps more details of the scenario would help...

0 Karma
Get Updates on the Splunk Community!

Splunk Observability Cloud | Unified Identity - Now Available for Existing Splunk ...

Raise your hand if you’ve already forgotten your username or password when logging into an account. (We can’t ...

Index This | How many sides does a circle have?

February 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

Registration for Splunk University is Now Open!

Are you ready for an adventure in learning?   Brace yourselves because Splunk University is back, and it's ...