Skip to main content

Module that emits CEF logs

Project description

Most Mozilla Services applications need to generate CEF logs. A CEF Log is a formatted log that can be used by ArcSight, a central application used by the infrasec team to manage application security.

The cef module provide a log_cef function that can be used to emit CEF logs:

log_cef(message, severity, environ, config, [username,

[signature]], **kw)

Creates a CEF record, and emit it in syslog or another file.

Args:
  • message: message to log

  • severity: integer from 0 to 10

  • environ: the WSGI environ object

  • config: configuration dict

  • signature: CEF signature code, defaults to ‘AuthFail’

  • username: user name, defaults to ‘none’

  • extra keywords: extra keys used in the CEF extension

Example:

>>> from cef import log_cef
>>> log_cef('SecurityAlert!', 5, environ, config,
...         msg='Someone has stolen my chocolate')

With environ and config provided by the web environment.

You can use the cef module with pythons logging module.

Example of logging configuration:

'syslog': {
    '()': cef.SysLogFormatter,
    'datefmt': '%H:%M:%s',
},

Send message to the log:

log_file.warning('Something', {environ: environ,
                               username: request.user,
                               data: data})

The SysLogFormatter will use the date format set in the log configuration (datefmt). It will convert the logging error level into a sys log error level.

CEF specific fields (version, vendor, device_version, product) can be also be provided, defaults will be used if not passed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cef-0.5.tar.gz (6.7 kB view details)

Uploaded Source

File details

Details for the file cef-0.5.tar.gz.

File metadata

  • Download URL: cef-0.5.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for cef-0.5.tar.gz
Algorithm Hash digest
SHA256 2d1cb558391673df5109a3fe5e84fde6160edc8b241b3eb19ab3d3abe9b8df31
MD5 bb084c60241fb7fc2a4d077b24bd7e5d
BLAKE2b-256 d12c815d67837029ee7021bbacf127aecf7ae04eeae35eb98163e2e787898726

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page