Graylog2 / Graylog2/graylog2-server

Cannot create pidfile using config (Graylog 2.5, Ubuntu 16.04)

Open
#5,660 0 comments 0 reactions 0 assignees View on GitHub
bug triaged
Dominant language
Java
Stars
8.1k
Forks
1.1k
Avg merge
1d 20h
Merged PRs (30d)
217

Description

## Expected Behavior
There are the file `/etc/default/graylog-server`. It has a variable called `GRAYLOG_SERVER_ARGS`. If I add `--pidfile` option, I expect that the pidfile will be created.

## Current Behavior
My args is look like this:
```
# Pass some extra args to graylog-server. (i.e. "-d" to enable debug mode)
GRAYLOG_SERVER_ARGS="-p /var/run/graylog/graylog-server.pid"
```
But in fact, nothing happens.

I've checked script `/usr/share/graylog-server/bin/graylog-server` and here its part:
```
$GRAYLOG_COMMAND_WRAPPER ${JAVA:=/usr/bin/java} $GRAYLOG_SERVER_JAVA_OPTS \
-jar -Dlog4j.configurationFile=file:///etc/graylog/server/log4j2.xml \
-Djava.library.path=/usr/share/graylog-server/lib/sigar \
-Dgraylog2.installation_source=${GRAYLOG_INSTALLATION_SOURCE:=unknown} \
/usr/share/graylog-server/graylog.jar server -f /etc/graylog/server/server.conf -np \
$GRAYLOG_SERVER_ARGS
```
Here's the problem. It's the `-np` option which blocks `--pidfile` effect. It means I need to create pidfile each time service starts, so I have no choice but remove this `-np` option directly here.

Also, I have checked the [code](https://github.com/Graylog2/graylog2-server/blob/master/graylog2-server/src/main/java/org/graylog2/bootstrap/ServerBootstrap.java#L74) and, as I can see, when `-np` is used it just disables pidfile. Position of `-np` doesn't matter, so if I use `--pidfile` after `-np` it takes no effect.

## Possible Solutions
I guess, there's two ways to fix it:
1. Remove `-np` from `/usr/share/graylog-server/bin/graylog-server` and move it to config `/etc/default/graylog-server`.
2. OR make `-np` dependent on its position.
## Your Environment

* Graylog Version: Version: 2.5.1-1
* Operating System: Ubuntu 16.04.3 LTS (systemd-based)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.