Module ecs

Module ecs 

Source
Expand description

Models which represent Elastic Common Schema (ECS) event and its fields

The event follows ECS Logging spec.

§Example

use ecs_logger::ecs::{Event, LogOrigin, LogOriginFile, LogOriginRust};

let event = Event {
    timestamp: chrono::Utc::now(),
    log_level: "ERROR",
    message: "Error!".to_string(),
    ecs_version: "1.12.1",
    log_origin: LogOrigin {
        file: LogOriginFile {
            line: Some(144),
            name: Some("server.rs"),
        },
        rust: LogOriginRust {
            target: "myApp",
            module_path: Some("my_app::server"),
            file_path: Some("src/server.rs"),
        },
    },
};

println!("{}", serde_json::to_string(&event).unwrap());

Structs§

Event
Representation of an event compatible with ECS logging.
LogOrigin
Information about the source code which logged the message.
LogOriginFile
Representation of the source code which logged the message.
LogOriginRust
Rust-specific information about the source code which logged the message.