Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've just started playing with logstash, and I'm having a problem getting a log shipper process to send events to a redis server on another host.

The output stanza of my logstash config file reads

output {
  redis { host => "11.22.33.44" data_type => "list" key => "logstash" }
}

However, when I run the logstash process, I get error messages containing

:exception=>#<SocketError: Network is unreachable>

A bit of straceing reveals that it's failing here:

connect(13, {sa_family=AF_INET6, sin6_port=htons(6379), inet_pton(AF_INET6, "::ffff:11.22.33.44", &sin6_addr) = -1 ENETUNREACH (Network is unreachable)

i.e. it's trying to connect to the redis host on an ipv6-mapped ipv4 address. The host doesn't have a native ipv6 address and the connection fails.

How can I either get the process to use AF_INET instead of AF_INET6, or somehow configure my host to work around the problem?

In case it's relevant, my java version is

java version "1.6.0_18"
OpenJDK Runtime Environment (IcedTea6 1.8.13) (6b18-1.8.13-0+squeeze2)
OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)
share|improve this question
    
Can you please paste the configs you are using in logstash –  GeekRide Mar 18 '13 at 12:55
    
There's not much more to my config than what I've posted... and the answer turned out to be nothing to do with logstash (see my answer). –  Flup Mar 18 '13 at 14:43

1 Answer 1

up vote 1 down vote accepted

This is caused by this bug: the sysctl setting net.ipv6.bindv6only=1 breaks Java networking in Debian squeeze (and probably other platforms).

The setting only seems to matter to people who want to distinguish ipv6 and ipv4 connections. I don't really care about this, so I did

$ sudo sysctl -w net.ipv6.bindv6only=0

started the logstash agent, and it worked!

The creator of logstash kindly told me afterwards that you can also add -Djava.net.preferIPv4Stack=true to the command line.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.