Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emelyanovkr/clickhouseappender
Custom Log4J2 Appender to store messages in ClickHouse DB
https://github.com/emelyanovkr/clickhouseappender
api clickhouse concurrency contribution java javaclient log4j2 log4j2-appender opensource
Last synced: 25 days ago
JSON representation
Custom Log4J2 Appender to store messages in ClickHouse DB
- Host: GitHub
- URL: https://github.com/emelyanovkr/clickhouseappender
- Owner: emelyanovkr
- License: mit
- Created: 2024-05-05T09:58:53.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-09-16T07:44:53.000Z (4 months ago)
- Last Synced: 2024-09-16T09:08:38.822Z (4 months ago)
- Topics: api, clickhouse, concurrency, contribution, java, javaclient, log4j2, log4j2-appender, opensource
- Language: Java
- Homepage:
- Size: 39.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ClickHouseAppender
This is a custom Log4j 2 appender that sends LOGGER messages to a clickhouse database in a specified table in JSON format. Table must have 2 columns:
```
CREATE TABLE log_table (
timestamp DateTime64 PRIMARY KEY,
log String
) Engine = MergeTree()
```All messages are stored in the [buffer](https://github.com/emelyanovkr/ClickHouseAppender/blob/main/src/main/java/com/clickhouse/appender/manager/LogBufferManager.java#L13C42-L13C56).
Log messages will be flushed straight to the ClickHouse DB after **one of the conditions**:
- timeout;
- buffer size limit exceeded;
- shutdown JVM ([SHUTDOWN-THREAD](https://github.com/emelyanovkr/ClickHouseAppender/blob/main/src/main/java/com/clickhouse/appender/manager/LogBufferManager.java#L53C7-L56C25))For acquiring a connection to the ClickHouse DB used a JavaClient API ([ClickHouse Java API](https://github.com/ClickHouse/clickhouse-java)).
### Configuring example
```
must be true for a ClickHouse Connection
SOCKET_TIMEOUT="300000"
/>
```