Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hootsuite/udp-logger
UDP logging to logstash for logback and log4j.
https://github.com/hootsuite/udp-logger
Last synced: 6 days ago
JSON representation
UDP logging to logstash for logback and log4j.
- Host: GitHub
- URL: https://github.com/hootsuite/udp-logger
- Owner: hootsuite
- License: other
- Created: 2014-03-20T22:34:23.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-03-25T18:20:25.000Z (over 10 years ago)
- Last Synced: 2024-04-14T21:16:07.884Z (7 months ago)
- Language: Scala
- Size: 304 KB
- Stars: 6
- Watchers: 9
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# UdpLogger
This library provides the capability to log over UDP to services such
as [logstash][logstash] (for further analysis in systems such as
[elastic search][elastic-search]). It provides appenders for logback and log4j, and a
caching DNS client to resolve servers in SRV records.## Components
The library has the following responsibilities:
* Accepts log events.
* Checks and caches service records to support UDP load balancing of log servers
is supported (using dnsjava). TTL is respected.
* Sends logged messages over UDP.
* Supports (and requires) a pluggable formatter. At HootSuite we use a structured JSON format.Since UDP is used, delivery is not assured.
## Configuration
Sample logback.xml fragment:
_logstash._udp.hootsuitemedia.com
DEBUG
...
Sample log4j-config.xml fragment:
...
You can add `debug="true"` to the root element to check you are sending log
messages correctly, or run `tcpdump -n udp` to watch the datagrams go.## Installation
Just include udp-logger and [DNS-java][dns-java] jars into your app's classpath or build-time dependencies, and
update your logger's configuration.## Run
UdpLogger also works as a standalone program to test resolution and
use of logstash servers. You may run it like this:java -cp scala-library.jar:udp-logger_2.9.1-0.2.jar:dnsjava-2.1.6.jar com.hootsuite.udplog.Main _logstash._udp.company.com "ECHO TEST"
After running, you should be able to see the log message either in
your log montoring system (e.g. [kibana][kibana]), or by running `tcpdump -n
udp and port 55555` on the target server.If the elastic search server didn't show the message, check your hosts can communicate over UDP.
1. ssh to the client server
2. ssh to the logstash server
3. `sudo tcpdump -n udp and host 204.15.173.160 and port 55555` on logstash
4. `echo 'test' | nc -u logstash1.hootsuite.com 55555` on client
5. check if logstash got a message which length is 4[logstash]: http://logstash.net/
[elastic-search]: http://elasticsearch.org/
[kibana]: http://www.elasticsearch.org/overview/kibana/
[udp-logger]: http://localhost
[dns-java]: http://www.dnsjava.org/download/