@ | A high water mark for the socket, after which messages will be discarded (if they're not sent). This prevents infinite buffering (and ergo infinite RAM use) if the thing you are sending to is down. Defaults to 10000 messages |
72 |
73 |
74 | h2. Examples of use
75 |
76 | h3. Publish log messages over TCP
77 |
78 | h4. Description
79 |
80 | In this example, the log messages will be encapsualted in a ØMQ message and published by the appender on a given address.
81 |
82 | Remote applications (subscribers) can connect to the ØMQ publisher socket and start receiving messages. The subscribers can also filter by log level the messages they want to receive.
83 |
84 | h4. Configuration
85 |
86 | The configuration of the Logback appender defines a Publisher socket:
87 |
88 |
89 |
90 | PUB
91 | tcp://*:9797
92 |
93 | %-5level %logger{26} - %msg
94 |
95 |
96 |
97 |
98 | h4. At runtime
99 |
100 | Once started, the appender sends log messages like this:
101 |
102 |
103 | DEBUG org.eclipse.jetty.util.log - doSelect true
104 |
105 |
106 | Remote application can now connect to the publisher address to receive log messages. The @ZMQSocketAppenderTest@ class gives an example of how to connect to the publisher and receive only ERROR messages.
107 |
108 | If no subscribers is connected, the publisher will drop the message (this is a default ØMQ behavior).
109 |
110 |
111 | h3. Index log messages in "Elasticsearch":http://www.elasticsearch.org/
112 |
113 | h4. Description
114 |
115 | In this example, the ØMQ appender is configured to send log messages to the "ØMQ transport plugin for Elasticsearch":https://github.com/tlrx/transport-zeromq
116 |
117 | This way, it is possible to index and search log messages with Elasticsearch features.
118 |
119 | h4. Configuration
120 |
121 | The configuration of the Logback appender defines a XREQ socket:
122 |
123 |
124 |
125 | ...
126 |
127 | XREQ
128 | tcp://localhost:9700
129 |
130 | POST|/logs/log/|{"origin":"my_app", "level":"%-5level", "message":"%msg", "thread":"%thread", "date":"%d{HH:mm:ss.SSS}", "logger":"%logger{26}", "exception":"%ex"}
131 |
132 |
133 | ...
134 |
135 |
136 |
137 |
138 | The ØMQ transport plugin for Elasticsearch listen by default on the @@ address.
139 |
140 | In this configuration, the pattern for log messages reflects the format expected by the Elasticsearch plugin.
141 |
142 | h4. At runtime
143 |
144 | Once started, the appender sends log messages to the Elasticsearch plugin, which index them in the *logs* index.
145 |
146 |
147 |
--------------------------------------------------------------------------------