Enum codecs::encoding::SerializerConfig
source · pub enum SerializerConfig {
Avro {
avro: AvroSerializerOptions,
},
Cef(CefSerializerConfig),
Csv(CsvSerializerConfig),
Gelf,
Json(JsonSerializerConfig),
Logfmt,
Native,
NativeJson,
Protobuf(ProtobufSerializerConfig),
RawMessage,
Text(TextSerializerConfig),
}
Expand description
Serializer configuration.
Variants§
Avro
Encodes an event as an Apache Avro message.
Fields
avro: AvroSerializerOptions
Apache Avro-specific encoder options.
Cef(CefSerializerConfig)
Encodes an event as a CEF (Common Event Format) formatted message.
Tuple Fields
0: CefSerializerConfig
Options for the CEF encoder.
Csv(CsvSerializerConfig)
Encodes an event as a CSV message.
This codec must be configured with fields to encode.
Gelf
Encodes an event as a GELF message.
This codec is experimental for the following reason:
The GELF specification is more strict than the actual Graylog receiver.
Vector’s encoder currently adheres more strictly to the GELF spec, with
the exception that some characters such as @
are allowed in field names.
Other GELF codecs such as Loki’s, use a Go SDK that is maintained by Graylog, and is much more relaxed than the GELF spec.
Going forward, Vector will use that Go SDK as the reference implementation, which means the codec may continue to relax the enforcement of specification.
Json(JsonSerializerConfig)
Encodes an event as JSON.
Logfmt
Encodes an event as a logfmt message.
Native
Encodes an event in the native Protocol Buffers format.
This codec is experimental.
NativeJson
Encodes an event in the native JSON format.
This codec is experimental.
Protobuf(ProtobufSerializerConfig)
Encodes an event as a Protobuf message.
RawMessage
No encoding.
This encoding uses the message
field of a log event.
Be careful if you are modifying your log events (for example, by using a remap
transform) and removing the message field while doing additional parsing on it, as this
could lead to the encoding emitting empty strings for the given event.
Text(TextSerializerConfig)
Plain text encoding.
This encoding uses the message
field of a log event. For metrics, it uses an
encoding that resembles the Prometheus export format.
Be careful if you are modifying your log events (for example, by using a remap
transform) and removing the message field while doing additional parsing on it, as this
could lead to the encoding emitting empty strings for the given event.
Implementations§
source§impl SerializerConfig
impl SerializerConfig
sourcepub fn build(
&self,
) -> Result<Serializer, Box<dyn Error + Send + Sync + 'static>>
pub fn build( &self, ) -> Result<Serializer, Box<dyn Error + Send + Sync + 'static>>
Build the Serializer
from this configuration.
sourcepub fn default_stream_framing(&self) -> FramingConfig
pub fn default_stream_framing(&self) -> FramingConfig
Return an appropriate default framer for the given serializer.
sourcepub fn input_type(&self) -> DataType
pub fn input_type(&self) -> DataType
The data type of events that are accepted by this Serializer
.
sourcepub fn schema_requirement(&self) -> Requirement
pub fn schema_requirement(&self) -> Requirement
The schema required by the serializer.
Trait Implementations§
source§impl Clone for SerializerConfig
impl Clone for SerializerConfig
source§fn clone(&self) -> SerializerConfig
fn clone(&self) -> SerializerConfig
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Configurable for SerializerConfig
impl Configurable for SerializerConfig
source§fn referenceable_name() -> Option<&'static str>
fn referenceable_name() -> Option<&'static str>
source§fn generate_schema(
schema_gen: &RefCell<SchemaGenerator>,
) -> Result<SchemaObject, GenerateError>
fn generate_schema( schema_gen: &RefCell<SchemaGenerator>, ) -> Result<SchemaObject, GenerateError>
§fn is_optional() -> boolwhere
Self: Sized,
fn is_optional() -> boolwhere
Self: Sized,
§fn validate_metadata(_metadata: &Metadata) -> Result<(), GenerateError>where
Self: Sized,
fn validate_metadata(_metadata: &Metadata) -> Result<(), GenerateError>where
Self: Sized,
§fn as_configurable_ref() -> ConfigurableRefwhere
Self: Sized + 'static,
fn as_configurable_ref() -> ConfigurableRefwhere
Self: Sized + 'static,
source§impl Debug for SerializerConfig
impl Debug for SerializerConfig
source§impl<'de> Deserialize<'de> for SerializerConfig
impl<'de> Deserialize<'de> for SerializerConfig
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>,
source§impl From<AvroSerializerConfig> for SerializerConfig
impl From<AvroSerializerConfig> for SerializerConfig
source§fn from(config: AvroSerializerConfig) -> Self
fn from(config: AvroSerializerConfig) -> Self
source§impl From<CefSerializerConfig> for SerializerConfig
impl From<CefSerializerConfig> for SerializerConfig
source§fn from(config: CefSerializerConfig) -> Self
fn from(config: CefSerializerConfig) -> Self
source§impl From<CsvSerializerConfig> for SerializerConfig
impl From<CsvSerializerConfig> for SerializerConfig
source§fn from(config: CsvSerializerConfig) -> Self
fn from(config: CsvSerializerConfig) -> Self
source§impl From<GelfSerializerConfig> for SerializerConfig
impl From<GelfSerializerConfig> for SerializerConfig
source§fn from(_: GelfSerializerConfig) -> Self
fn from(_: GelfSerializerConfig) -> Self
source§impl From<JsonSerializerConfig> for SerializerConfig
impl From<JsonSerializerConfig> for SerializerConfig
source§fn from(config: JsonSerializerConfig) -> Self
fn from(config: JsonSerializerConfig) -> Self
source§impl From<LogfmtSerializerConfig> for SerializerConfig
impl From<LogfmtSerializerConfig> for SerializerConfig
source§fn from(_: LogfmtSerializerConfig) -> Self
fn from(_: LogfmtSerializerConfig) -> Self
source§impl From<NativeJsonSerializerConfig> for SerializerConfig
impl From<NativeJsonSerializerConfig> for SerializerConfig
source§fn from(_: NativeJsonSerializerConfig) -> Self
fn from(_: NativeJsonSerializerConfig) -> Self
source§impl From<NativeSerializerConfig> for SerializerConfig
impl From<NativeSerializerConfig> for SerializerConfig
source§fn from(_: NativeSerializerConfig) -> Self
fn from(_: NativeSerializerConfig) -> Self
source§impl From<ProtobufSerializerConfig> for SerializerConfig
impl From<ProtobufSerializerConfig> for SerializerConfig
source§fn from(config: ProtobufSerializerConfig) -> Self
fn from(config: ProtobufSerializerConfig) -> Self
source§impl From<RawMessageSerializerConfig> for SerializerConfig
impl From<RawMessageSerializerConfig> for SerializerConfig
source§fn from(_: RawMessageSerializerConfig) -> Self
fn from(_: RawMessageSerializerConfig) -> Self
source§impl From<TextSerializerConfig> for SerializerConfig
impl From<TextSerializerConfig> for SerializerConfig
source§fn from(config: TextSerializerConfig) -> Self
fn from(config: TextSerializerConfig) -> Self
source§impl Serialize for SerializerConfig
impl Serialize for SerializerConfig
Auto Trait Implementations§
impl Freeze for SerializerConfig
impl RefUnwindSafe for SerializerConfig
impl Send for SerializerConfig
impl Sync for SerializerConfig
impl Unpin for SerializerConfig
impl UnwindSafe for SerializerConfig
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
§fn deserialize(
&self,
deserializer: &mut D,
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
§impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
type Error = <Target as OctetsFrom<Source>>::Error
§fn try_octets_into(
self,
) -> Result<Target, <Source as OctetsInto<Target>>::Error>
fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>
§fn octets_into(self) -> Targetwhere
Self::Error: Into<Infallible>,
fn octets_into(self) -> Targetwhere
Self::Error: Into<Infallible>,
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
§fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
§fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
§fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
§fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
§fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
§fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
§fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
§fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
§fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
§fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
§fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
§fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
§fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
§fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
§fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
§fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
§fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
§fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
§fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg
or
a color-specific method, such as OwoColorize::green
, Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg
or
a color-specific method, such as OwoColorize::on_yellow
, Read more