Skip to content

Add configurable data plane log level #2561

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions apis/v1alpha1/nginxproxy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ type NginxProxySpec struct {
// +optional
//nolint:lll
RewriteClientIP *RewriteClientIP `json:"rewriteClientIP,omitempty"`
// Logging defines logging related settings for NGINX.
//
// +optional
Logging *NginxLogging `json:"logging,omitempty"`
// DisableHTTP2 defines if http2 should be disabled for all servers.
// Default is false, meaning http2 will be enabled for all servers.
//
Expand Down Expand Up @@ -203,3 +207,43 @@ const (
// kubebuilder:validation:Pattern=`^[\.a-zA-Z0-9:]*(\/([0-9]?[0-9]?[0-9]))$`
AddressTypeCIDR AddressType = "cidr"
)

// NginxLogging defines logging related settings for NGINX.
type NginxLogging struct {
// Level defines the error log level.
//
// +optional
// +kubebuilder:default=info
Level *NginxLogLevel `json:"level,omitempty"`
}

// NginxLogLevel type defines the log level of error logs for NGINX.
//
// +kubebuilder:validation:Enum=debug;info;notice;warn;error;crit;alert;emerg
type NginxLogLevel string

const (
// NginxLogLevelDebug is the debug level for NGINX error logs.
NginxLogLevelDebug NginxLogLevel = "debug"

// NginxLogLevelInfo is the info level for NGINX error logs.
NginxLogLevelInfo NginxLogLevel = "info"

// NginxLogLevelNotice is the notice level for NGINX error logs.
NginxLogLevelNotice NginxLogLevel = "notice"

// NginxLogLevelWarn is the warn level for NGINX error logs.
NginxLogLevelWarn NginxLogLevel = "warn"

// NginxLogLevelError is the error level for NGINX error logs.
NginxLogLevelError NginxLogLevel = "error"

// NginxLogLevelCrit is the crit level for NGINX error logs.
NginxLogLevelCrit NginxLogLevel = "crit"

// NginxLogLevelAlert is the alert level for NGINX error logs.
NginxLogLevelAlert NginxLogLevel = "alert"

// NginxLogLevelEmerg is the emerg level for NGINX error logs.
NginxLogLevelEmerg NginxLogLevel = "emerg"
)
25 changes: 25 additions & 0 deletions apis/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions config/crd/bases/gateway.nginx.org_nginxproxies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,23 @@ spec:
- ipv4
- ipv6
type: string
logging:
description: Logging defines logging related settings for NGINX.
properties:
level:
default: info
description: Level defines the error log level.
enum:
- debug
- info
- notice
- warn
- error
- crit
- alert
- emerg
type: string
type: object
rewriteClientIP:
description: RewriteClientIP defines configuration for rewriting the
client IP to the original client's IP.
Expand Down
17 changes: 17 additions & 0 deletions deploy/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,23 @@ spec:
- ipv4
- ipv6
type: string
logging:
description: Logging defines logging related settings for NGINX.
properties:
level:
default: info
description: Level defines the error log level.
enum:
- debug
- info
- notice
- warn
- error
- crit
- alert
- emerg
type: string
type: object
rewriteClientIP:
description: RewriteClientIP defines configuration for rewriting the
client IP to the original client's IP.
Expand Down
105 changes: 105 additions & 0 deletions site/content/reference/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,20 @@ RewriteClientIP
</tr>
<tr>
<td>
<code>logging</code><br/>
<em>
<a href="#gateway.nginx.org/v1alpha1.NginxLogging">
NginxLogging
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Logging defines logging related settings for NGINX.</p>
</td>
</tr>
<tr>
<td>
<code>disableHTTP2</code><br/>
<em>
bool
Expand Down Expand Up @@ -987,6 +1001,83 @@ Logging
</tr>
</tbody>
</table>
<h3 id="gateway.nginx.org/v1alpha1.NginxLogLevel">NginxLogLevel
(<code>string</code> alias)</p><a class="headerlink" href="#gateway.nginx.org%2fv1alpha1.NginxLogLevel" title="Permanent link">¶</a>
</h3>
<p>
(<em>Appears on: </em>
<a href="#gateway.nginx.org/v1alpha1.NginxLogging">NginxLogging</a>)
</p>
<p>
<p>NginxLogLevel type defines the log level of error logs for NGINX.</p>
</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Value</th>
<th>Description</th>
</tr>
</thead>
<tbody><tr><td><p>&#34;alert&#34;</p></td>
<td><p>NginxLogLevelAlert is the alert level for NGINX error logs.</p>
</td>
</tr><tr><td><p>&#34;crit&#34;</p></td>
<td><p>NginxLogLevelCrit is the crit level for NGINX error logs.</p>
</td>
</tr><tr><td><p>&#34;debug&#34;</p></td>
<td><p>NginxLogLevelDebug is the debug level for NGINX error logs.</p>
</td>
</tr><tr><td><p>&#34;emerg&#34;</p></td>
<td><p>NginxLogLevelEmerg is the emerg level for NGINX error logs.</p>
</td>
</tr><tr><td><p>&#34;error&#34;</p></td>
<td><p>NginxLogLevelError is the error level for NGINX error logs.</p>
</td>
</tr><tr><td><p>&#34;info&#34;</p></td>
<td><p>NginxLogLevelInfo is the info level for NGINX error logs.</p>
</td>
</tr><tr><td><p>&#34;notice&#34;</p></td>
<td><p>NginxLogLevelNotice is the notice level for NGINX error logs.</p>
</td>
</tr><tr><td><p>&#34;warn&#34;</p></td>
<td><p>NginxLogLevelWarn is the warn level for NGINX error logs.</p>
</td>
</tr></tbody>
</table>
<h3 id="gateway.nginx.org/v1alpha1.NginxLogging">NginxLogging
<a class="headerlink" href="#gateway.nginx.org%2fv1alpha1.NginxLogging" title="Permanent link">¶</a>
</h3>
<p>
(<em>Appears on: </em>
<a href="#gateway.nginx.org/v1alpha1.NginxProxySpec">NginxProxySpec</a>)
</p>
<p>
<p>NginxLogging defines logging related settings for NGINX.</p>
</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>level</code><br/>
<em>
<a href="#gateway.nginx.org/v1alpha1.NginxLogLevel">
NginxLogLevel
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Level defines the error log level.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="gateway.nginx.org/v1alpha1.NginxProxySpec">NginxProxySpec
<a class="headerlink" href="#gateway.nginx.org%2fv1alpha1.NginxProxySpec" title="Permanent link">¶</a>
</h3>
Expand Down Expand Up @@ -1050,6 +1141,20 @@ RewriteClientIP
</tr>
<tr>
<td>
<code>logging</code><br/>
<em>
<a href="#gateway.nginx.org/v1alpha1.NginxLogging">
NginxLogging
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Logging defines logging related settings for NGINX.</p>
</td>
</tr>
<tr>
<td>
<code>disableHTTP2</code><br/>
<em>
bool
Expand Down
Loading