The graylog Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The graylog Reference Manual

This is the graylog Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Aug 15 03:42:15 2022 GMT+0.

Table of Contents


1 Introduction

CL-GRAYLOG

Graylog Common Lisp client

https://www.graylog.org/

Install

Install graylog server. For easy setup, you can use docker:

$ docker pull graylog2/allinone
$ docker run -t -p 9000:9000 -p 12201:12201 graylog2/allinone

Load the library:

(ql:quickload :graylog)

Usage

(graylog:connect-graylog-toplevel)
(graylog:graylog "hello world")

Log5

The library comes with a Log5 sender so you can simply use Log5 to log to Graylog

(ql:quickload :graylog-log5)

(log5:defcategory app)

(log5:start-sender 'app
        (graylog/log5:graylog-sender)
        :category-spec '(app log5:info+)
        :output-spec '(log5:time log5:category log5:message))

(log5:log-for app "Hello from log5")

Functions

connect-graylog

(&key (host "localhost") (port *default-gelf-port*)
 (hostname *default-host-name*))

Connect to a graylog instance

HOSTNAME: According to GELF spec, it can be the name of the host, source or application that sent this message

connect-graylog-toplevel

(&rest args)

Connect to graylog and set the global connection

graylog

(message &rest args &key (level 1) backtrace host
 (connection (graylog-connection)))

Log to graylog using GELF

https://www.graylog.org/resources/gelf/

Version 1.1 (11/2013) A GELF message is a GZIP’d or ZLIB’d JSON string with the following fields:

version string (UTF-8)

GELF spec version – “1.1”; MUST be set by client library.

host string (UTF-8)

the name of the host, source or application that sent this message; MUST be set by client library.

short_message string (UTF-8)

a short descriptive message; MUST be set by client library.

full_message string (UTF-8)

a long message that can i.e. contain a backtrace; optional.

timestamp number

Seconds since UNIX epoch with optional decimal places for milliseconds; SHOULD be set by client library. Will be set to NOW by server if absent.

level number

the level equal to the standard syslog levels; optional, default is 1 (ALERT).

facility string (UTF-8)

optional, deprecated. Send as additional field instead.

line number

the line in a file that caused the error (decimal); optional, deprecated. Send as additional field instead.

file string (UTF-8)

the file (with path if you want) that caused the error (string); optional, deprecated. Send as additional field instead.

_[additional field] string (UTF-8) or number

every field you send and prefix with a _ (underscore) will be treated as an additional field. Allowed characters in field names are any word character (letter, number, underscore), dashes and dots. The verifying regular expression is: ^[w.-]*$

Libraries SHOULD not allow to send id as additional field (_id). Graylog server nodes omit this field automatically.

graylog-connection

(&key (error-p t))

Return the current graylog connection

Macros

with-graylog-connection

((&key (host) (port)) &body body)

Run body within the scope of a graylog


2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 graylog

Graylog Lisp client

Author

Mariano Montone <marianomontone@gmail.com>

License

MIT

Dependencies
  • local-time (system).
  • usocket (system).
  • babel (system).
  • salza2 (system).
  • cl-json (system).
  • trivial-backtrace (system).
Source

graylog.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.1 graylog/graylog.asd

Source

graylog.asd.

Parent Component

graylog (system).

ASDF Systems

graylog.


3.1.2 graylog/package.lisp

Source

graylog.asd.

Parent Component

graylog (system).

Packages

graylog.


Previous: , Up: Lisp   [Contents][Index]

3.1.3 graylog/graylog.lisp

Dependency

package.lisp (file).

Source

graylog.asd.

Parent Component

graylog (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 graylog

Source

package.lisp.

Use List

common-lisp.

Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Public Interface


5.1.1 Macros

Macro: with-graylog-connection ((&key host port) &body body)

Run body within the scope of a graylog connection

Package

graylog.

Source

graylog.lisp.


Previous: , Up: Public Interface   [Contents][Index]

5.1.2 Ordinary functions

Function: connect-graylog (&key host port hostname)

Connect to a graylog instance

HOSTNAME: According to GELF spec, it can be the name of the host, source or application that sent this message

Package

graylog.

Source

graylog.lisp.

Function: connect-graylog-toplevel (&rest args)

Connect to graylog and set the global connection

Package

graylog.

Source

graylog.lisp.

Function: graylog (message &rest args &key level backtrace host connection &allow-other-keys)

Log to graylog using GELF

https://www.graylog.org/resources/gelf/

Version 1.1 (11/2013)
A GELF message is a GZIP’d or ZLIB’d JSON string with the following fields:

version string (UTF-8)

GELF spec version – “1.1”; MUST be set by client library.

host string (UTF-8)

the name of the host, source or application that sent this message; MUST be set by client library.

short_message string (UTF-8)

a short descriptive message; MUST be set by client library.

full_message string (UTF-8)

a long message that can i.e. contain a backtrace; optional.

timestamp number

Seconds since UNIX epoch with optional decimal places for milliseconds; SHOULD be set by client library. Will be set to NOW by server if absent.

level number

the level equal to the standard syslog levels; optional, default is 1 (ALERT).

facility string (UTF-8)

optional, deprecated. Send as additional field instead.

line number

the line in a file that caused the error (decimal); optional, deprecated. Send as additional field instead.

file string (UTF-8)

the file (with path if you want) that caused the error (string); optional, deprecated. Send as additional field instead.

_[additional field] string (UTF-8) or number

every field you send and prefix with a _ (underscore) will be treated as an additional field. Allowed characters in field names are any word character (letter, number, underscore), dashes and dots. The verifying regular expression is: ^[w.-]*$

Libraries SHOULD not allow to send id as additional field (_id). Graylog server nodes omit this field automatically.

Package

graylog.

Source

graylog.lisp.

Function: graylog-connection (&key error-p)

Return the current graylog connection

Package

graylog.

Source

graylog.lisp.


5.2 Internals


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.1 Special variables

Special Variable: *default-gelf-port*
Package

graylog.

Source

graylog.lisp.

Special Variable: *default-host-name*
Package

graylog.

Source

graylog.lisp.

Special Variable: *graylog-connection*
Package

graylog.

Source

graylog.lisp.


Previous: , Up: Internals   [Contents][Index]

5.2.2 Ordinary functions

Function: call-with-graylog-connection (function &key host port hostname)
Package

graylog.

Source

graylog.lisp.


Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts