pub struct EventMessage {
pub event_type: String,
pub timestamp: f64,
pub hostname: Option<String>,
pub utcoffset: Option<i32>,
pub pid: Option<u32>,
pub clock: Option<u64>,
pub fields: HashMap<String, Value>,
}Expand description
Base event message structure
Fields§
§event_type: StringEvent type
timestamp: f64Timestamp when event occurred
hostname: Option<String>Hostname of the sender
utcoffset: Option<i32>UTC offset
pid: Option<u32>Process ID
clock: Option<u64>Clock value (for ordering)
fields: HashMap<String, Value>Additional event-specific fields
Implementations§
Source§impl EventMessage
impl EventMessage
Sourcepub fn with_timestamp(self, timestamp: DateTime<Utc>) -> Self
pub fn with_timestamp(self, timestamp: DateTime<Utc>) -> Self
Create an event with a specific timestamp
Sourcepub fn with_hostname(self, hostname: impl Into<String>) -> Self
pub fn with_hostname(self, hostname: impl Into<String>) -> Self
Set the hostname
Sourcepub fn with_clock(self, clock: u64) -> Self
pub fn with_clock(self, clock: u64) -> Self
Set the clock value
Sourcepub fn with_field(self, key: impl Into<String>, value: Value) -> Self
pub fn with_field(self, key: impl Into<String>, value: Value) -> Self
Add a custom field
Sourcepub fn get_datetime(&self) -> DateTime<Utc>
pub fn get_datetime(&self) -> DateTime<Utc>
Get the timestamp as DateTime
Trait Implementations§
Source§impl Clone for EventMessage
impl Clone for EventMessage
Source§fn clone(&self) -> EventMessage
fn clone(&self) -> EventMessage
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EventMessage
impl Debug for EventMessage
Source§impl<'de> Deserialize<'de> for EventMessage
impl<'de> Deserialize<'de> for EventMessage
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<EventType> for EventMessage
impl From<EventType> for EventMessage
Source§impl PartialEq for EventMessage
impl PartialEq for EventMessage
Source§impl Serialize for EventMessage
impl Serialize for EventMessage
impl StructuralPartialEq for EventMessage
Auto Trait Implementations§
impl Freeze for EventMessage
impl RefUnwindSafe for EventMessage
impl Send for EventMessage
impl Sync for EventMessage
impl Unpin for EventMessage
impl UnwindSafe for EventMessage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more