the default for rest_transport_uri leads to non deterministic behavior

Bug #1818615 reported by Andrea Ieri
26
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Graylog Charm
Fix Released
Medium
Wouter van Bommel

Bug Description

The default for the charm setting rest_transport_uri is unset, which in conjunction with a hardcoded default of "rest_listen_uri = http://0.0.0.0:9001/api/" triggers the behavior described in the documentation[0]: binding to the first non-loopback IPv4 address.
If the graylog unit is hosting LXDs, that address may be lxdbr0, and since ordering does not appear to be numeric or alphabetic, the "first" address can vary across reboots.

I propose that the default be changed to the IP address of the interface residing in the space the website endpoint is bound to.

[0] https://docs.graylog.org/en/2.3/pages/configuration/server.conf.html

Related branches

Revision history for this message
Vern Hart (vern) wrote :

+1 to this.

The standard FCB bundle now has graylog-mongodb deployed in an lxd container on the graylog unit. This didn't used to be the case, which is why this bug has only recently surfaced.

We worked around this by changing the juju config for rest_transport_uri to the "real" primary IP of the graylog unit:

  juju config graylog rest_transport_uri=http://10.1.2.3:9001/api/

Another work-around would be to not put graylog-mongodb in a lxd container on the graylog unit.

tags: added: cpe-onsite
Alvaro Uria (aluria)
tags: added: canonical-bootstack
Revision history for this message
Haw Loeung (hloeung) wrote :

Perhaps something like this, which we use in various other places, to work out the primary / default IP address used by the unit to communicate with the world:

| def get_ip_address():
| # http://stackoverflow.com/questions/166506/finding-local-ip-addresses-using-pythons-stdlib
| import socket
| s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
| # No connection is actually made to this address, so there are no firewalling requirements.
| s.connect(('91.189.89.199', 123))
| ip = s.getsockname()[0]
| s.close()
| return netaddr.IPAddress(ip)

Alvaro Uria (aluria)
Changed in graylog-charm:
status: New → Confirmed
importance: Undecided → Medium
Changed in graylog-charm:
assignee: nobody → Wouter van Bommel (woutervb)
Xav Paice (xavpaice)
Changed in charm-graylog:
status: Confirmed → In Progress
Xav Paice (xavpaice)
Changed in charm-graylog:
status: In Progress → Fix Committed
Jeremy Lounder (jldev)
Changed in charm-graylog:
status: Fix Committed → Fix Released
Alvaro Uria (aluria)
Changed in charm-graylog:
milestone: none → 20.05
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.