Kvasir.Syslog (kvasir v1.0.1)
Syslog structure for storing the message.
Summary
Types
The facility is one of the filters syslog uses to know how to filter the logs received in a fast and easy way. The facility is regarding the kind of service that is generating the log, i.e. user, mail, or ftp.
Severity is the level of importance for the log and another kind of filter we could apply to the logs. We could indicate emergency, critical, warning, or debug.
The information about the log generated you can check Kvasir.Syslog.Encode
and Kvasir.Syslog.Decoder
to know how it's encoded and decoded from the
string format.
Functions
Add structured data for a given Syslog struct. It's indeed setting the new value inside of the structured data and if that value exists it's replaced.
Get the number of the facility given the atom (see facility/0
).
Get the PRIVAL, the value we can see in the log messages as a number. It's the combination between the facility and severity.
Create a new Syslog struct.
Set the facility for the giving Syslog structure. You can use both,
numbers between 0 and 23 or an valid atom (see facility/0
).
Set the severity for the given Syslog struct. You can use both
a number between 0 and 7 or an atom (see severity/0
).
Types
@type facility() ::
:kernel
| :user_level
| :user
| :mail
| :daemon
| :auth
| :internal
| :printer
| :network
| :uucp
| :clock
| :security
| :ftp
| :ntp
| :audit
| :alert
| :note2
| :local0
| :local1
| :local2
| :local3
| :local4
| :local5
| :local6
| :local7
The facility is one of the filters syslog uses to know how to filter the logs received in a fast and easy way. The facility is regarding the kind of service that is generating the log, i.e. user, mail, or ftp.
@type severity() ::
:emergency
| :alert
| :critical
| :error
| :warn
| :warning
| :notice
| :info
| :debug
Severity is the level of importance for the log and another kind of filter we could apply to the logs. We could indicate emergency, critical, warning, or debug.
@type t() :: %Kvasir.Syslog{ app_name: nil | String.t(), facility: nil | facility(), hostname: nil | String.t(), ip_address: nil | String.t(), message: nil | String.t(), message_id: nil | String.t(), process_id: nil | String.t(), rfc: :rfc3164 | :rfc5424, severity: nil | severity(), structured_data: %{ required(String.t()) => %{required(String.t()) => String.t()} }, timestamp: nil | DateTime.t(), version: nil | pos_integer() }
The information about the log generated you can check Kvasir.Syslog.Encode
and Kvasir.Syslog.Decoder
to know how it's encoded and decoded from the
string format.
The fields included are:
rfc
indicating the kind of RFC the log is following, we have mainly two RFC to choose: RFC3164 and RFC5424.facility
you can see thefacility/0
type.severity
you can see theseverity/0
type.version
is the version and it should be a number greater than 0.hostname
is the hostname where the log is generated.ip_address
is the IP address, it could be IPv4 or IPv6.app_name
is the name of the application that generated the log.process_id
is the PID of the OS process that generated the log.message_id
is the ID for the message generated.timestamp
is the date and time about when the log was generated.structured_data
is a set of structured data shared instead or in addition to the message.message
the log message generated.
Functions
Add structured data for a given Syslog struct. It's indeed setting the new value inside of the structured data and if that value exists it's replaced.
Get the number of the facility given the atom (see facility/0
).
Get the PRIVAL, the value we can see in the log messages as a number. It's the combination between the facility and severity.
Create a new Syslog struct.
Set the facility for the giving Syslog structure. You can use both,
numbers between 0 and 23 or an valid atom (see facility/0
).
Set the severity for the given Syslog struct. You can use both
a number between 0 and 7 or an atom (see severity/0
).