Skip to main content

RequestLog

Struct RequestLog 

Source
pub struct RequestLog { /* private fields */ }
Expand description

An append-only, size-bounded record of every request the node served.

§Format

One JSON object per line — the same shape as ops.jsonl and lag.jsonl, so the same tools read it — carrying format_version, the wall-clock time, the authenticated user, the method, the redacted path, the status, the response body size and the elapsed microseconds.

§Rotation

Size-bounded and single-generation. When the file passes max_bytes it is renamed to <path>.1, replacing any previous .1, and a fresh file is started. Disk is therefore bounded at roughly twice max_bytes with no timer, no cron entry and no external logrotate — a node that runs unattended for a year cannot fill its disk with this. The cost of that simplicity is stated plainly: exactly two generations are kept, so an operator who needs deeper history copies the file out on their own schedule.

§Durability

One unbuffered write_all per request, no fsync. An incident log that loses its tail to a buffer is worthless, and an fsync per request would put a disk round-trip in every response path — this is an observation, not the durable record.

Implementations§

Source§

impl RequestLog

Source

pub fn open(path: PathBuf, max_bytes: u64) -> Result<Self>

Opens path for append, creating it, and rotates at max_bytes.

§Errors

Propagates the failure to open the file. This is fatal at startup by design: an operator who asked for a request log and did not get one should find out before the node starts serving, not from the absence of evidence during an incident.

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, 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> Same for T

Source§

type Output = T

Should always be Self
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.