LogHub

所属分类:Java编程
开发工具:Java
文件大小:0KB
下载次数:0
上传日期:2023-10-27 20:01:35
上 传 者sh-1993
说明:  日志中心,,
(LogHub,,)

文件列表:
.circleci/ (0, 2023-12-18)
.circleci/config.yml (8192, 2023-12-18)
.circleci/settings.xml (850, 2023-12-18)
LICENSE (560, 2023-12-18)
pom.xml (43242, 2023-12-18)
src/ (0, 2023-12-18)
src/lombok.config (70, 2023-12-18)
src/main/ (0, 2023-12-18)
src/main/antlr4/ (0, 2023-12-18)
src/main/antlr4/loghub/ (0, 2023-12-18)
src/main/antlr4/loghub/Route.g4 (14345, 2023-12-18)
src/main/java/ (0, 2023-12-18)
src/main/java/groovy/ (0, 2023-12-18)
src/main/java/groovy/runtime/ (0, 2023-12-18)
src/main/java/groovy/runtime/metaclass/ (0, 2023-12-18)
src/main/java/groovy/runtime/metaclass/GroovyMethods.java (1788, 2023-12-18)
src/main/java/groovy/runtime/metaclass/java/ (0, 2023-12-18)
src/main/java/groovy/runtime/metaclass/java/java/ (0, 2023-12-18)
src/main/java/groovy/runtime/metaclass/java/java/time/ (0, 2023-12-18)
src/main/java/groovy/runtime/metaclass/java/java/time/temporal/ (0, 2023-12-18)
src/main/java/groovy/runtime/metaclass/java/java/time/temporal/TemporalMetaClass.java (1923, 2023-12-18)
src/main/java/groovy/runtime/metaclass/java/lang/ (0, 2023-12-18)
src/main/java/groovy/runtime/metaclass/java/lang/CharacterMetaClass.java (1565, 2023-12-18)
src/main/java/groovy/runtime/metaclass/java/lang/NumberMetaClass.java (4010, 2023-12-18)
src/main/java/groovy/runtime/metaclass/java/lang/StringMetaClass.java (1562, 2023-12-18)
src/main/java/groovy/runtime/metaclass/java/util/ (0, 2023-12-18)
src/main/java/groovy/runtime/metaclass/java/util/CollectionMetaClass.java (1555, 2023-12-18)
src/main/java/loghub/ (0, 2023-12-18)
src/main/java/loghub/AbstractBuilder.java (1026, 2023-12-18)
src/main/java/loghub/AbstractCompDecomp.java (2568, 2023-12-18)
src/main/java/loghub/AsyncProcessor.java (1233, 2023-12-18)
src/main/java/loghub/BuilderClass.java (377, 2023-12-18)
src/main/java/loghub/CachingParser.java (3675, 2023-12-18)
src/main/java/loghub/CanBatch.java (408, 2023-12-18)
src/main/java/loghub/Compressor.java (1111, 2023-12-18)
src/main/java/loghub/ConnectionContext.java (1348, 2023-12-18)
src/main/java/loghub/Dashboard.java (5175, 2023-12-18)
src/main/java/loghub/Decompressor.java (944, 2023-12-18)
src/main/java/loghub/EventsProcessor.java (15864, 2023-12-18)
... ...

# LogHub Loghub is a pipeline log, close to [logstash](https://www.elastic.co/products/logstash "Collect, Enrich & Transport Data"). But it's written in java for improved stability and performance. It received events from external sources, process them and send them. All components are organized in many pipeline that can be interconnect. A pipeline goes from one receiver source that generate events, send through processor and forward them to a sender or another pipeline. Receiver source uses decoders that takes bytes messages and generate a event from that. Sender source uses decoders that take event and produce bytes message that are then send to the configured destination. All of these five kind of operator (Receivers, Senders, Processors, Coders and Decoders) are java classes that can be derived for custom usages. For configuration it uses a [DSL](https://en.wikipedia.org/wiki/Domain-specific_language "Domain specific language") generated using [antlr](http://www.antlr.org "ANother Tool for Language Recognition"). It's syntax is a strange mix of logstash configuration files, java and a small tast of groovy. The exact grammar can be found at https://github.com/fbacchella/LogHub/blob/master/src/main/antlr4/loghub/Route.g4. It look like: input { loghub.receivers.ZMQ { listen: "tcp://localhost:2120", decoder: loghub.decoders.Log4j } } | $main input { loghub.receivers.Udp { port: 2121 decoder: loghub.decoders.Msgpack } } | $apache output $main | { loghub.senders.ElasticSearch } pipeline[apache] { loghub.processors.Geoip { datfilepath:"/user/local/share/GeoIP/GeoIP.dat", locationfield:"location", threads:4 } } pipeline[main] { loghub.processors.Log { threads: 2 } | event.logger_name == "jrds.starter.Timer" || event.info > 4 ? loghub.processors.Drop : ( loghub.processors.ParseJson | loghub.processors.Groovy { script: "println event['logger_name']" } ) } extensions: "/usr/share/loghub/plugins:/usr/share/loghub/scripts" This configuration define two receivers, one that listen using 0MQ for log4j events. The other listen for msgpack encoded events on a udp port, like some that can be generated by [mod_log_net](https://github.com/fbacchella/mod_log_net "An UDP logger for Apache"). The events received on UDP are send to one pipeline called "apache". All the events are transfered to the default "main" pipeline after resolving location from visitors. The log4j events are directly send to the main pipeline, that does some magic treatment on it. Pay attention to the test. It will be evaluated as a groovy scripts. A property called "extensions" is defined. It allows to define custom extensions folders that will be used to resolve scripts and added to the class path. In the configuration file, all the agent are defined using directly the class name. If needed, slow or CPU bound processor can be given more dedicated threads by specifying a specific number of threads. They will be still one processor class instance, but many threads will send events to it.

近期下载者

相关文件


收藏者