Setting the node ID in the Graylog container

Hello

I am testing graylog on containers and would love to set the node_id of the container, but regardless of what do node_id is automatically generated.

I am going up the environment as follows

docker run --name mongo -d mongo:3
docker run --name elasticsearch \
-e "http.host=0.0.0.0" \
-e "ES_JAVA_OPTS=-Xms512m -Xmx512m" \
-d docker.elastic.co/elasticsearch/elasticsearch-oss:6.7.0
docker run --name graylog --link mongo --link elasticsearch \
-p 9000:9000 -p 12201:12201 -p 1514:1514 \
-e GRAYLOG_NODE_ID="dec7fa69-ae3b-488f-970d-ef707e727345" \
-e GRAYLOG_HTTP_EXTERNAL_URI="http://10.2.1.236:9000/" \
-e GRAYLOG_ROOT_PASSWORD_SHA2=8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92 \
-e GRAYLOG_PASSWORD_SECRET=fGoTI07CooB6xNy5sdPVSKSuq6QSu2QyWf6G9z3haolgwbERTQ9ZbfbF6hxRYbJMMAlEZX7CXHxJLBkNyfM0420u8aFuZy9M \
-d graylog/graylog:3.1

Using GRAYLOG_NODE_ID environment variable, but logs show that ID was automatically generated:

2019-09-06 16:56:18,840 INFO : org.graylog2.plugin.system.NodeId - No node ID file found. Generated: 6c141513-2bd8-42f0-9f30-98d790c27833

I did some other tests using the variable in other ways

-e GRAYLOG_NODE_ID=yyyyyf61-3876-4005-89c1-34204efxxxxx
-e GRAYLOG_NODE_ID="dec7fa69-ae3b-488f-970d-ef707e727345"
-e GRAYLOG_NODE_ID=1234
-e GRAYLOG_NODE_ID='12'

I also tested pointing the ID file of my computer directly:

-v /tmp/node-id:/etc/graylog/server/node-id:ro \
-v /tmp/node-id:/opt/graylog/config/node-id:ro \

Unfortunately the ID is always randomly generated.
I wonder if it is possible to manually set the ID for graylog in container.

tks

the setting name is node_id_file.

If you have that available from the outside, in the correct location it will work. The file location in the docker image is /usr/share/graylog/config/node-id

Hello Jan

Really didn’t know the correct path to the file in the image was this:
/usr/share/graylog/config/node-id

What I find strange is that I made the adjustment but still graylog doesn’t recognize the node id file.

example:

cat /tmp/node-id
9a71d762-c6a1-47fb-bcfe-3917424expto

docker run --name mongo -d mongo:3
docker run --name elasticsearch \
-e "http.host=0.0.0.0" \
-e "ES_JAVA_OPTS=-Xms512m -Xmx512m" \
-d docker.elastic.co/elasticsearch/elasticsearch-oss:6.7.0
docker run --name graylog --link mongo --link elasticsearch \
-p 9000:9000 -p 12201:12201 -p 1514:1514 \
-e GRAYLOG_HTTP_EXTERNAL_URI="http://127.0.0.1:9000/" \
-e GRAYLOG_ROOT_PASSWORD_SHA2=8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92 \
-e GRAYLOG_PASSWORD_SECRET=fGoTI07CooB6xNy5sdPVSKSuq6QSu2QyWf6G9z3haolgwbERTQ9ZbfbF6hxRYbJMMAlEZX7CXHxJLBkNyfM0420u8aFuZy9M \
-v /tmp/node-id:/usr/share/graylog/config/node-id \
-d graylog/graylog:3.1

I also tested declaring the file:

docker run --name mongo -d mongo:3
docker run --name elasticsearch \
-e "http.host=0.0.0.0" \
-e "ES_JAVA_OPTS=-Xms512m -Xmx512m" \
-d docker.elastic.co/elasticsearch/elasticsearch-oss:6.7.0
docker run --name graylog --link mongo --link elasticsearch \
-p 9000:9000 -p 12201:12201 -p 1514:1514 \
-e GRAYLOG_HTTP_EXTERNAL_URI="http://127.0.0.1:9000/" \
-e GRAYLOG_ROOT_PASSWORD_SHA2=8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92 \
-e GRAYLOG_PASSWORD_SECRET=fGoTI07CooB6xNy5sdPVSKSuq6QSu2QyWf6G9z3haolgwbERTQ9ZbfbF6hxRYbJMMAlEZX7CXHxJLBkNyfM0420u8aFuZy9M \
-e GRAYLOG_NODE_ID_FILE=/tmp/node-id \
-d graylog/graylog:3.1

Is there any more configuration to be done?

thank you very much

I have that via volumen mount in docker compose:

so it is working -

Hello Jan

I really couldn’t make it work using the example you provided.

Anyway I searched inside the container and realized that when there is no node-id file a new one is generated in the location:
/usr/share/graylog/data/config/node-id

So I made the file assembly pointing this location, was as follows.
-v /tmp/node-id:/usr/share/graylog/data/config/node-id

The complete syntax was as follows:

docker run --name mongo -d mongo:3
docker run --name elasticsearch \
-e "http.host=0.0.0.0" \
-e "ES_JAVA_OPTS=-Xms512m -Xmx512m" \
-d docker.elastic.co/elasticsearch/elasticsearch-oss:6.7.0
docker run --name graylog --link mongo --link elasticsearch \
-p 9000:9000 -p 12201:12201 -p 1514:1514 \
-e GRAYLOG_HTTP_EXTERNAL_URI="http://127.0.0.1:9000/" \
-e GRAYLOG_ROOT_PASSWORD_SHA2=8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92 \
-e GRAYLOG_PASSWORD_SECRET=fGoTI07CooB6xNy5sdPVSKSuq6QSu2QyWf6G9z3haolgwbERTQ9ZbfbF6hxRYbJMMAlEZX7CXHxJLBkNyfM0420u8aFuZy9M \
-v /tmp/node-id:/usr/share/graylog/data/config/node-id \
-d graylog/graylog:3.1

With that graylog recognized the file and accepted the ID.

graylog_nodeid

As always thank you very much for all the help.
Enjoyed, I find it very interesting the github repository learned several things from it.

Tks