Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 50 additions & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ edition = "2024"
license = "Apache-2.0"

[workspace]
members = [".", "logjetd", "demo", "ljx"]
default-members = [".", "logjetd", "demo", "ljx"]
members = [".", "logjetd", "demo", "ljx", "liblogjet"]
default-members = [".", "logjetd", "demo", "ljx", "liblogjet"]

[profile.release]
lto = true
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ fn replay_batches() -> Result<(), Box<dyn std::error::Error>> {
## Notes

- Examples for standalone usage live in [examples](./examples).
- C and C++ shared-library usage lives in [doc/c-cpp-integration.md](./doc/c-cpp-integration.md).
- The reader is sequential by design.
- Compression is per block, not per file.
- The payload bytes are opaque to `logjet`.
2 changes: 2 additions & 0 deletions demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ It also contains scenario demos under subdirectories:
- one replay client stalls while another keeps flowing
- [`replay-handoff`](./replay-handoff)
- a late replay client drains retained backlog and then continues live on the same connection
- [`cpp-shared-lib`](./cpp-shared-lib)
- a C++ process loads `liblogjet.so`, sends OTLP logs into `ljd`, and opens the result in `ljx view`
- [`file-replay`](./file-replay)
- replay stored `.logjet` files into a collector
- [`file-tooling`](./file-tooling)
Expand Down
46 changes: 46 additions & 0 deletions demo/cpp-shared-lib/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# C++ Shared Library Demo

This demo shows one C++ process loading a Rust shared library and sending OTLP
logs into `ljd` over gRPC.

The path is:

`C++ appliance -> liblogjet.so -> OTLP/gRPC -> ljd -> .logjet file -> ljx view`

## Build First

From the project root:

```bash
cargo build -p ljd -p ljx -p liblogjet
```

You also need `g++` available locally because the demo compiles the C++
example on demand.

## Run

From this directory:

```bash
./run-demo.sh
```

## What It Does

The script:

1. builds the example C++ logger
2. starts file-backed `ljd` on `127.0.0.1:4317`
3. loads `liblogjet.so` through `dlopen`
4. sends 25 OTLP log records from C++ by default
5. opens `ljx view` on the resulting `./logs/cpp-demo.logjet`

## Notes

- the library now supports both OTLP/HTTP and OTLP/gRPC constructors
- this demo specifically uses OTLP/gRPC
- the FFI API is intentionally small: endpoint, service name, timestamp, severity, message body, and string attributes
- those key/value pairs become OTLP `LogRecord.attributes`, which is the standard OTel metadata field for log records
- if the appliance already has JSON metadata, the better long-term shape is to flatten that JSON into separate attributes where possible; a raw JSON blob can still be sent as one string attribute when needed
- the demo uses a local symlink named `liblogjet.so` that points at Cargo's built shared object
Binary file added demo/cpp-shared-lib/cpp-logger
Binary file not shown.
Loading
Loading