LogScaleUnstructuredLogger

Struct LogScaleUnstructuredLogger 

Source
pub struct LogScaleUnstructuredLogger { /* private fields */ }

Implementations§

Source§

impl LogScaleUnstructuredLogger

Source

pub fn init( url: String, ingest_token: String, options: LoggerOptions, ) -> Result<(), Box<dyn Error>>

Examples found in repository?
examples/log_unstructured.rs (lines 17-21)
9async fn main() {
10    let args: Vec<String> = env::args().collect();
11
12    let ingest_token = args
13        .get(1)
14        .expect("Missing '--ingest-token' parameter.")
15        .replace("--ingest-token=", "");
16
17    LogScaleUnstructuredLogger::init(
18        String::from("https://cloud.community.humio.com"),
19        ingest_token,
20        LoggerOptions::default(),
21    )
22    .unwrap();
23
24    log::set_max_level(log::LevelFilter::Trace);
25
26    // Loop to let the background sync task have time to do its thing.
27    // Assumes that the provided ingest token has been set up with an "accesslog" parser to be able to parse the log line below.
28    loop {
29        info!("192.168.1.21 - user1 [26/Sep/2023:14:48:26 +0000] \"POST /humio/api/v1/ingest/elastic-bulk HTTP/1.1\" 200 0 \"-\" \"useragent\" 0.015 664 0.015");
30
31        std::thread::sleep(Duration::from_secs(1));
32    }
33}

Trait Implementations§

Source§

impl Log for LogScaleUnstructuredLogger

Source§

fn enabled(&self, _: &Metadata<'_>) -> bool

Determines if a log message with the specified metadata would be logged. Read more
Source§

fn log(&self, record: &Record<'_>)

Logs the Record. Read more
Source§

fn flush(&self)

Flushes any buffered records. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,