-
Notifications
You must be signed in to change notification settings - Fork 0
/
logging-cfg-django-prod.yaml
142 lines (136 loc) · 4.09 KB
/
logging-cfg-django-prod.yaml
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
version: 1
disable_existing_loggers: False # this allow to get logger at module level
root:
handlers:
- console
level: WARNING
propagate: True
loggers:
stac_api:
level: WARNING
middleware:
level: WARNING
middleware.logging:
level: INFO
django:
level: WARNING
gunicorn.error:
level: WARNING
handlers:
- console
gunicorn.access:
level: WARNING
handlers:
- console
filters:
type_filter:
(): logging_utilities.filters.attr_type_filter.AttrTypeFilter
typecheck_list:
request: django.http.request.HttpRequest
isotime:
(): logging_utilities.filters.TimeAttribute
isotime: False
utc_isotime: True
add_request:
(): logging_utilities.filters.add_thread_context_filter.AddThreadContextFilter
contexts:
- logger_key: request
context_key: request
django:
(): logging_utilities.filters.django_request.JsonDjangoRequest
attr_name: request
include_keys:
- request.path
- request.method
- request.headers
- request.META.QUERY_STRING
exclude_keys:
- request.headers.Authorization
- request.headers.Proxy-Authorization
- request.headers.Cookie
# These two are present when using gunicorn and cannot be correctly jsonified.
- request.META.gunicorn
- request.META.wsgi
formatters:
json:
(): logging_utilities.formatters.json_formatter.JsonFormatter
add_always_extra: False
filter_attributes:
- utc_isotime
remove_empty: True
ignore_missing: True
fmt:
# ECS fields
message: message
event:
category: web
created: utc_isotime
duration: response.duration
kind: event
module: module
# severity: levelno
http:
request:
id: request.headers.X-Amz-Cf-Id
method: request.method
headers:
Content-Type: request.headers.Content-Type
Content-Length: request.headers.Content-Length
Cloudfront-Forwarded-Proto: request.headers.Cloudfront-Forwarded-Proto
Content-Encoding: request.headers.Content-Encoding
Origin: request.headers.Origin
Referer: request.headers.Referer
Accept: request.headers.Accept
Accept-Encoding: request.headers.Accept-Encoding
Accept-Language: request.headers.Accept-Language
User-Agent: request.headers.User-Agent
If-None-Match: request.headers.If-None-Match
Sec-Fetch-Mode: request.headers.Sec-Fetch-Mode
Sec-Fetch-Site: request.headers.Sec-Fetch-Site
Sec-CH-UA: request.headers.Sec-CH-UA
Sec-CH-UA-Mobile: request.headers.Sec-CH-UA-Mobile
Sec-CH-UA-Platform: request.headers.Sec-CH-UA-Platform
Sec-CH-UA-Model: request.headers.Sec-CH-UA-Model
body:
content: request.payload
response:
status_code: response.code
headers:
Cache-Control: response.headers.Cache-Control
Expires: response.headers.Expires
Content-Type: response.headers.Content-Type
Content-Length: response.headers.Content-Length
Content-Encoding: response.headers.Content-Encoding
Access-Control-Allow-Headers: response.headers.Access-Control-Allow-Headers
Access-Control-Allow-Methods: response.headers.Access-Control-Allow-Methods
Access-Control-Allow-Origin: response.headers.Access-Control-Allow-Origin
ETag: response.headers.ETag
body:
content: response.payload
log:
level: levelname
logger: name
origin:
file:
line: lineno
name: module
function: funcName
process:
pid: process
thread:
id: thread
service:
type: service_type
url:
path: request.path
query: request.META.QUERY_STRING
handlers:
console:
class: logging.StreamHandler
formatter: json
stream: ext://sys.stdout
filters:
- type_filter
- isotime
- add_request
- django