package syslog-message
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=f9eca2bfa26f0b410ab371b5b39aa816d2b46d4e18838d401e0e4d73ac43f70d
sha512=7bcf7d6b8085614a440c67a655c90353f56a55a7e0888fc9a1e7b7dec7a84bb32d36324fd157fd70942b0d868cc85e19272e7700ccc68362e15b5d4b6df66993
doc/syslog-message/Syslog_message/index.html
Module Syslog_message
Source
Syslog message parser and unparser
Syslog-message
is a module for handling syslog messages, as defined in RFC 3164.
The parse
function transforms a string to a syslog message t
, using a context of default parameters. Such a message can be transformed into a string to_string
or pretty printed pp_string
, pp
.
1.2.0 - homepage
type facility =
| Kernel_Message
| User_Level_Messages
| Mail_System
| System_Daemons
| Security_Authorization_Messages
| Messages_Generated_Internally_By_Syslogd
| Line_Printer_Subsystem
| Network_News_Subsystem
| UUCP_subsystem
| Clock_Daemon
| Security_Authorization_Messages_10
| Ftp_Daemon
| Ntp_Subsystem
| Log_Audit
| Log_Alert
| Clock_Daemon_15
| Local0
| Local1
| Local2
| Local3
| Local4
| Local5
| Local6
| Local7
The type for Facilities
string_of_facility f
is data
, the string representation of f
.
The type for Severity levels
string_of_severity s
is data
, the string representation of s
.
ctx
provides additional information to the parse
function in case one of the sub-parsers fails.
timestamp
: Atimestamp
hostname
: Hostname, IPv4 or IPv6 address of the sender. "-" if unknown.set_hostname
: If true, theparse
function will skip its hostname sub-parser and use the hostname fromctx
instead.
set_hostname
is automatically set by the timestamp sub-parser when it fails, because at this point it is no longer possible to determine the hostname from the input string.
type t = {
facility : facility;
severity : severity;
timestamp : Ptime.t;
hostname : string;
tag : string;
content : string;
}
The type for Syslog messages
pp ppf t
prints the syslog message t
on ppf
.
decode ~ctx data
is t
, either Ok t
, a successfully decoded syslog message, or Error e
.
encode ~len t
is data
, the encoded syslog message t
, truncated to len
bytes. If len
is 0 the output is not truncated.
Warning: Since version 1.0.0, messages are no longer truncated to 1024 bytes by default.
encode_local ~len t
behaves as encode
except that the message is formatted for sending to the local syslog daemon (e.g. on /dev/log
).
RFC 3164 Timestamps