Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added CEF logging. Bug 709195, issue #20.

  • Loading branch information...
commit 28e1fec35317bbc657b0d97fd748006b15f6119b 1 parent 50f39d3
Fred Wenzel fwenzel authored
Showing with 14 additions and 1 deletion.
  1. +9 −0 apps/examples/views.py
  2. +5 −1 settings/local.py-dist
9 apps/examples/views.py
View
@@ -1,10 +1,13 @@
"""Example views. Feel free to delete this app."""
+import logging
+
from django import http
from django.shortcuts import render
import bleach
import commonware
+from funfactory.log import log_cef
from mobility.decorators import mobile_template
from session_csrf import anonymous_csrf
@@ -33,4 +36,10 @@ def bleach_test(request):
if bleachme:
data['bleached'] = bleach.clean(bleachme, tags=allowed_tags)
+ # CEF logging: Log user input that needed to be "bleached".
+ if data['bleached'] != bleachme:
+ log_cef('Bleach Alert', logging.INFO, request,
+ username='anonymous', signature='BLEACHED',
+ msg='User data needed to be bleached: %s' % bleachme)
+
return render(request, 'examples/bleach.html', data)
6 settings/local.py-dist
View
@@ -67,4 +67,8 @@ SECRET_KEY = ''
## Log settings
# SYSLOG_TAG = "http_app_playdoh" # Make this unique to your project.
-# LOGGING = dict(loggers=dict(playdoh = {'level': logging.DEBUG}))
+# LOGGING = dict(loggers=dict(playdoh={'level': logging.DEBUG}))
+
+# Common Event Format logging parameters
+#CEF_PRODUCT = 'Playdoh'
+#CEF_VENDOR = 'Mozilla'
Please sign in to comment.
Something went wrong with that request. Please try again.