1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
|
.TH os_sup 3 "os_mon 2.1.6" "Ericsson AB" "ERLANG MODULE DEFINITION"
.SH MODULE
os_sup \- Interface to OS System Messages
.SH DESCRIPTION
.LP
\fIos_sup\fR is a process providing a message passing service from the operating system to the error logger in the Erlang runtime system\&. It is part of the OS_Mon application, see os_mon(6)\&. Available for Solaris and Windows\&.
.LP
Messages received from the operating system results in an user defined callback function being called\&. This function can do whatever filtering and formatting is necessary and then deploy any type of logging suitable for the user\&'s application\&.
.SH SOLARIS OPERATION
.LP
The Solaris (SunOS 5\&.x) messages are retrieved from the syslog-daemon, \fIsyslogd\fR\&.
.LP
Enabling the service includes actions which require root privileges, such as change of ownership and file privileges of an executable binary file, and creating a modified copy of the configuration file for \fIsyslogd\fR\&. When \fIos_sup\fR is terminated, the service must be disabled, meaning the original configuration must be restored\&. Enabling/disabling can be done either outside or inside \fIos_sup\fR, see Configuration below\&.
.SS Warning:
.LP
This process cannot run in multiple instances on the same hardware\&. OS_Mon must be configured to start \fIos_sup\fR on one node only if two or more Erlang nodes execute on the same machine\&.
.LP
The format of received events is not defined\&.
.SH WINDOWS OPERATION
.LP
The Windows messages are retreived from the eventlog file\&.
.LP
The \fInteventlog\fR module is used to implement \fIos_sup\fR\&. See nteventlog(3)\&. Note that the start functions of \fInteventlog\fR does not need to be used, in this case the process is started automatically as part of the OS_Mon supervision tree\&.
.LP
OS messages are formatted as a tuple \fI{Time, Category, Facility, Severity, Message}\fR:
.RS 2
.TP 4
.B
\fITime = {MegaSecs, Secs, MicroSecs}\fR:
A time stamp as returned by the BIF \fInow()\fR\&.
.TP 4
.B
\fICategory = string()\fR:
Usually one of \fI"System"\fR, \fI"Application"\fR or \fI"Security"\fR\&. Note that the NT eventlog viewer has another notion of category, which in most cases is totally meaningless and therefore not imported into Erlang\&. What is called a category here is one of the main three types of events occuring in a normal NT system\&.
.TP 4
.B
\fIFacility = string()\fR:
The source of the message, usually the name of the application that generated it\&. This could be almost any string\&. When matching messages from certain applications, the version number of the application may have to be accounted for\&. This is what the NT event viewer calls "source"\&.
.TP 4
.B
\fISeverity = string()\fR:
One of \fI"Error"\fR, \fI"Warning"\fR, \fI"Informational"\fR, \fI"Audit_Success"\fR, \fI"Audit_Faulure"\fR or, in case of a currently unknown Windows NT version \fI"Severity_Unknown"\fR\&.
.TP 4
.B
\fIMessage = string()\fR:
Formatted exactly as it would be in the NT eventlog viewer\&. Binary data is not imported into Erlang\&.
.RE
.SH CONFIGURATION
.RS 2
.TP 4
.B
\fIos_sup_mfa = {Module, Function, Args}\fR:
The callback function to use\&. \fIModule\fR and \fIFunction\fR are atoms and \fIArgs\fR is a list of terms\&. When an OS message \fIMsg\fR is received, this function is called as \fIapply(Module, Function, [Msg | Args])\fR\&.
.RS 4
.LP
.LP
Default is \fI{os_sup, error_report, [Tag]}\fR which will send the event to the error logger using error_logger:error_report(Tag, Msg)\&. \fITag\fR is the value of \fIos_sup_errortag\fR, see below\&.
.RE
.TP 4
.B
\fIos_sup_errortag = atom()\fR:
This parameter defines the error report type used when messages are sent to error logger using the default callback function\&. Default is \fIstd_error\fR, which means the events are handled by the standard event handler\&.
.TP 4
.B
\fIos_sup_enable = bool()\fR:
Solaris only\&. Defines if the service should be enabled (and disabled) inside (\fItrue\fR) or outside (\fIfalse\fR) \fIos_sup\fR\&. For backwards compatibility reasons, the default is \fItrue\fR\&. The recommended value is \fIfalse\fR, as the Erlang emulator should normally not be run with \fIroot\fR privileges, as is required for enabling the service\&.
.TP 4
.B
\fIos_sup_own = string()\fR:
Solaris only\&. Defines the directory which contains the backup copy and the Erlang specific configuration files for \fIsyslogd\fR, and a named pipe to receive the messages from \fIsyslogd\fR\&. Default is \fI"/etc"\fR\&.
.TP 4
.B
\fIos_sup_syslogconf = string()\fR:
Solaris only\&. Defines the full name of the configuration file for \fIsyslogd\fR\&. Default is \fI"/etc/syslog\&.conf"\fR\&.
.RE
.SH EXPORTS
.LP
.B
enable() -> ok | {error, Res}
.br
.B
enable(Dir, Conf) -> ok | {error, Error}
.br
.RS
.TP
Types
Dir = Conf = Res = string()
.br
.RE
.RS
.LP
Enables the \fIos_sup\fR service\&. Needed on Solaris only\&.
.LP
If the configuration parameter \fIos_sup_enable\fR is \fIfalse\fR, this function is called automatically by \fIos_sup\fR, using the values of \fIos_sup_own\fR and \fIos_sup_syslogconf\fR as arguments\&.
.LP
If \fIos_sup_enable\fR is \fItrue\fR, this function must be called \fIbefore\fR OS_Mon/\fIos_sup\fR is started\&. \fIDir\fR defines the directory which contains the backup copy and the Erlang specific configuration files for \fIsyslogd\fR, and a named pipe to receive the messages from \fIsyslogd\fR\&. Defaults to \fI"/etc"\fR\&. \fIConf\fR defines the full name of the configuration file for \fIsyslogd\fR\&. Default is \fI"/etc/syslog\&.conf"\fR\&.
.LP
Results in a OS call to:
.nf
<PRIVDIR>/bin/mod_syslog otp Dir Conf
.fi
.LP
where \fI<PRIVDIR>\fR is the \fIpriv\fR directory of OS_Mon, \fIcode:priv_dir(os_mon)\fR\&.
.LP
Returns \fIok\fR if this yields the expected result \fI"0"\fR, and \fI{error, Res}\fR if it yields anything else\&.
.SS Note:
.LP
This function requires root privileges to succeed\&.
.RE
.LP
.B
disable() -> ok | {error, Res}
.br
.B
disable(Dir, Conf) -> ok | {error, Error}
.br
.RS
.TP
Types
Dir = Conf = Res = string()
.br
.RE
.RS
.LP
Disables the \fIos_sup\fR service\&. Needed on Solaris only\&.
.LP
If the configuration parameter \fIos_sup_enable\fR is \fIfalse\fR, this function is called automatically by \fIos_sup\fR, using the same arguments as when \fIenable/2\fR was called\&.
.LP
If \fIos_sup_enable\fR is \fItrue\fR, this function must be called \fIafter\fR OS_Mon/\fIos_sup\fR is stopped\&. \fIDir\fR defines the directory which contains the backup copy and the Erlang specific configuration files for \fIsyslogd\fR, and a named pipe to receive the messages from \fIsyslogd\fR\&. Defaults to \fI"/etc"\fR\&. \fIConf\fR defines the full name of the configuration file for \fIsyslogd\fR\&. Default is \fI"/etc/syslog\&.conf"\fR\&.
.LP
Results in a OS call to:
.nf
<PRIVDIR>/bin/mod_syslog nootp Dir Conf
.fi
.LP
where \fI<PRIVDIR>\fR is the \fIpriv\fR directory of OS_Mon, \fIcode:priv_dir(os_mon)\fR\&.
.LP
Returns \fIok\fR if this yields the expected result \fI"0"\fR, and \fI{error, Res}\fR if it yields anything else\&.
.SS Note:
.LP
This function requires root privileges to succeed\&.
.RE
.SH SEE ALSO
.LP
error_logger(3), os_mon(3)
.LP
\fIsyslogd(1M)\fR, \fIsyslog\&.conf(4)\fR in the Solaris documentation\&.
.LP
|