pub struct Log { /* private fields */ }Expand description
A simplified log representation that keeps track of where each field was found.
A log on the wire is a JSON object with a handful of envelope fields (message, status, hostname, service,
ddsource, timestamp, and ddtags), optionally other top-level keys, and a message that may itself be a JSON
object serialized as a string. The Agent puts all log properties inside that string, while other producers may put
them at the top level. Keeping the two locations apart means that a property that moved from one to the other shows
up as a difference, rather than being normalized away.
Implementations§
Source§impl Log
impl Log
Sourcepub fn try_from_payload(payload: &[u8]) -> Result<Vec<Self>, GenericError>
pub fn try_from_payload(payload: &[u8]) -> Result<Vec<Self>, GenericError>
Parses a decompressed logs intake payload, which is a JSON array of log objects.
§Errors
If the payload isn’t valid JSON, isn’t an array of objects, or has a ddtags field that isn’t a string, an
error is returned.
Returns the envelope ddtags field as a set.
Like the logs intake, the raw string is split on ,, each element is trimmed, and empty elements and duplicates
are dropped.
Sourcepub fn envelope_properties(&self) -> &BTreeMap<String, Value>
pub fn envelope_properties(&self) -> &BTreeMap<String, Value>
Returns top-level keys other than the envelope fields.
Sourcepub fn content_properties(&self) -> Option<&BTreeMap<String, Value>>
pub fn content_properties(&self) -> Option<&BTreeMap<String, Value>>
Returns the properties parsed from the envelope message, if it’s a string holding a JSON object.
Sourcepub fn envelope_field(&self, name: &str) -> Option<&Value>
pub fn envelope_field(&self, name: &str) -> Option<&Value>
Returns the envelope field with the given name, if it’s one of the fields held as a raw value.
ddtags isn’t held as a raw value, so it isn’t returned here; use Log::ddtags instead.
Sourcepub fn display_message(&self) -> Option<&Value>
pub fn display_message(&self) -> Option<&Value>
Returns the displayed message: the content’s message when the content is a JSON object, or else the envelope
message.
Sourcepub fn semantic_view(&self) -> BTreeMap<String, Value>
pub fn semantic_view(&self) -> BTreeMap<String, Value>
Returns a location-independent view of the log, used to identify the same log on both sides of a comparison.
Envelope fields and other top-level keys come first, then content properties overwrite them. When the content
is a JSON object, the raw envelope message is left out, since its properties are already present. ddtags
is included as a sorted array.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Log
impl<'de> Deserialize<'de> for Log
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>,
impl Eq for Log
impl StructuralPartialEq for Log
Auto Trait Implementations§
impl Freeze for Log
impl RefUnwindSafe for Log
impl Send for Log
impl Sync for Log
impl Unpin for Log
impl UnsafeUnpin for Log
impl UnwindSafe for Log
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<T> Track for T
impl<T> Track for T
§fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self>
fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self>
Tracked wrapper. Read more§fn in_current_resource_group(self) -> Tracked<Self>
fn in_current_resource_group(self) -> Tracked<Self>
Tracked wrapper. Read more