Connection is failing for gelf

I am trying to send the gelf java logs to my graylog servers.
when i tried to send the logs manually from command line I am getting connection failure message.

> echo -n -e '{ "version": "1.1", "host": "example.org", "short_message": "A short message", "level": 5, "_some_info": "foo" }'"\0" | nc -w5 10.140.127.133 12202
> Ncat: Connection refused.
> 
> curl -X POST -H 'Content-Type: application/json' -d '{ "version": "1.1", "host": "example.org", "short_message": "A short message", "level": 5, "_some_info": "foo" }' 'https://10.140.127.133:12201/gelf'

it seems i am not able to connect on ‘https://10.140.127.133:12201/gelf’.

I have configured the log4j.xml on mu application server side.

    <appender name="graylog2_import" class="org.graylog2.log.GelfAppender">
                    <param name="graylogHost" value="xxxxxxxxxx"/>
                    <param name="graylogPort" value="12202"/>
                    <param name="originHost" value="xxxxxxxxxxx"/>
                    <param name="extractStacktrace" value="true"/>
                    <param name="addExtendedInformation" value="true"/>
                    <param name="facility" value="gelf-java"/>
                    <param name="Threshold" value="DEBUG"/>
                    <param name="additionalFields" value="{'environment': 'xxxxxxxxxx', 'application': 'glassfish', 'buildingblock': 'xxxxxxxx', 'logtype': 'import'}"/>
            </appender>

and defined the logger.

Now i am not sure what i am missing to send the gelf java logs from my glassfish application.

On graylog server do you see the port as open? Did you configure the port as input? Do you have firewall? Do you enabled the traffic? Do you see the traffic on the GL server? etc.

If you can’t connect to the port nothing else important. Not cares do you set the log4j well or not if you can’t send a TCP package well in your system.

Now, I can see my graylog sidecar collector is running but no logs is pushing to Graylog.

if you want solution maybe you should read other’s posts.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.