hsyslog-tcp-0.2.1.0: syslog over TCP

Maintaineromeragacan@gmail.com
Stabilityprovisional
PortabilityPosix
Safe HaskellNone
LanguageHaskell2010

System.Posix.Syslog.TCP

Contents

Description

Log messages to syslog over a network via TCP, with protocols such as RFC 5424 or RFC 3164.

Most of the code adapted from hsyslog-udp.

Synopsis

Haskell API to syslog via TCP

initSyslog :: SyslogConfig -> IO SyslogConn Source #

Connect to the remote syslog server over TCP.

See also documentation for SyslogConn.

type SyslogFn Source #

Arguments

 = Facility

facility to log to

-> Severity

severity under which to log

-> Text

message body (should not contain newline)

-> IO () 

data SyslogConn Source #

Constructors

SyslogConn 

Fields

  • _syslogConnSend :: SyslogFn

    Callback for sending logs to the connected remote syslog server. This function re-throws exceptions, blocks when the TCP socket is not ready for writing.

  • _syslogConnClose :: IO ()

    Callback for closing the connection.

data SyslogConfig Source #

Configuration options for connecting and logging to your syslog socket.

Constructors

SyslogConfig 

Fields

defaultConfig :: HostName -> ServiceName -> IO (Maybe SyslogConfig) Source #

A helper for constructing a SyslogConfig. Uses rsyslogTCPProtocol. Returns Nothing when getAddrInfo fails.

Utilities for constructing SyslogConfig

Protocols for use with SyslogConfig

Syslog TCP packet component datatypes

Re-exports from hsyslog

data Priority :: * #

Log messages have a priority attached.

Constructors

Emergency

system is unusable

Alert

action must be taken immediately

Critical

critical conditions

Error

error conditions

Warning

warning conditions

Notice

normal but significant condition

Info

informational

Debug

debug-level messages

data Facility :: * #

Syslog distinguishes various system facilities. Most applications should log in USER.

Constructors

KERN

kernel messages

USER

user-level messages (default unless set otherwise)

MAIL

mail system

DAEMON

system daemons

AUTH

security/authorization messages

SYSLOG

messages generated internally by syslogd

LPR

line printer subsystem

NEWS

network news subsystem

UUCP

UUCP subsystem

CRON

clock daemon

AUTHPRIV

security/authorization messages (effectively equals AUTH on some systems)

FTP

ftp daemon (effectively equals DAEMON on some systems)

LOCAL0

reserved for local use

LOCAL1

reserved for local use

LOCAL2

reserved for local use

LOCAL3

reserved for local use

LOCAL4

reserved for local use

LOCAL5

reserved for local use

LOCAL6

reserved for local use

LOCAL7

reserved for local use

Instances

Bounded Facility 
Enum Facility 
Eq Facility 
Read Facility 
Show Facility 
Generic Facility 

Associated Types

type Rep Facility :: * -> * #

Methods

from :: Facility -> Rep Facility x #

to :: Rep Facility x -> Facility #

type Rep Facility 
type Rep Facility = D1 (MetaData "Facility" "System.Posix.Syslog" "hsyslog-4-CMAlwHXQD1qFjIKM83acRk" False) ((:+:) ((:+:) ((:+:) ((:+:) (C1 (MetaCons "KERN" PrefixI False) U1) (C1 (MetaCons "USER" PrefixI False) U1)) ((:+:) (C1 (MetaCons "MAIL" PrefixI False) U1) ((:+:) (C1 (MetaCons "DAEMON" PrefixI False) U1) (C1 (MetaCons "AUTH" PrefixI False) U1)))) ((:+:) ((:+:) (C1 (MetaCons "SYSLOG" PrefixI False) U1) (C1 (MetaCons "LPR" PrefixI False) U1)) ((:+:) (C1 (MetaCons "NEWS" PrefixI False) U1) ((:+:) (C1 (MetaCons "UUCP" PrefixI False) U1) (C1 (MetaCons "CRON" PrefixI False) U1))))) ((:+:) ((:+:) ((:+:) (C1 (MetaCons "AUTHPRIV" PrefixI False) U1) (C1 (MetaCons "FTP" PrefixI False) U1)) ((:+:) (C1 (MetaCons "LOCAL0" PrefixI False) U1) ((:+:) (C1 (MetaCons "LOCAL1" PrefixI False) U1) (C1 (MetaCons "LOCAL2" PrefixI False) U1)))) ((:+:) ((:+:) (C1 (MetaCons "LOCAL3" PrefixI False) U1) (C1 (MetaCons "LOCAL4" PrefixI False) U1)) ((:+:) (C1 (MetaCons "LOCAL5" PrefixI False) U1) ((:+:) (C1 (MetaCons "LOCAL6" PrefixI False) U1) (C1 (MetaCons "LOCAL7" PrefixI False) U1))))))

data PriorityMask :: * #

withSyslog options for the priority mask.

Constructors

NoMask

allow all messages thru

Mask [Priority]

allow only messages with the priorities listed

UpTo Priority

allow only messages down to and including the specified priority

Newtypes for various String/Int values

Refer to RFC 5424 section 6.2 as to the purpose of each.

newtype AppName :: * #

Constructors

AppName ByteString

see APP-NAME

Instances

newtype HostName :: * #

Constructors

HostName ByteString

see HOSTNAME; fetch via getHostName

newtype ProcessID :: * #

Constructors

ProcessID ByteString

see PROCID; fetch via getProcessId

Type aliases

What syslog refers to as Priority, RFC 5424 calls Severity.