Skip to main content

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.

Metadata

Release files for cef 0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cef 0.5
File Size Uploaded Provenance
cef-0.5.tar.gz 6.7 kB Without provenance Details

Release files / cef-0.5.tar.gz

Download URL cef-0.5.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2d1cb558391673df5109a3fe5e84fde6160edc8b241b3eb19ab3d3abe9b8df31
BLAKE2b-256 checksum
How to use checksums
d12c815d67837029ee7021bbacf127aecf7ae04eeae35eb98163e2e787898726
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for cef 0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page