@@ -23,7 +23,6 @@ type Config struct {
2323 DetachedHeadRoom time.Duration `json:"detached_head_room_msecs"`
2424 MaxResponseSize uint64 `json:"max_response_size_bytes"`
2525 MaxHdrResponseSize uint64 `json:"max_hdr_response_size_bytes"`
26- MaxLogSize uint64 `json:"max_log_size_bytes"`
2726 MaxTotalCPU uint64 `json:"max_total_cpu_mcpus"`
2827 MaxTotalMemory uint64 `json:"max_total_memory_bytes"`
2928 MaxFsSize uint64 `json:"max_fs_size_mb"`
@@ -36,6 +35,7 @@ type Config struct {
3635 MaxTmpFsInodes uint64 `json:"max_tmpfs_inodes"`
3736 DisableReadOnlyRootFs bool `json:"disable_readonly_rootfs"`
3837 DisableDebugUserLogs bool `json:"disable_debug_user_logs"`
38+ UserLogLevel string `json:"user_log_level"`
3939 IOFSEnableTmpfs bool `json:"iofs_enable_tmpfs"`
4040 IOFSAgentPath string `json:"iofs_path"`
4141 IOFSMountRoot string `json:"iofs_mount_root"`
@@ -65,16 +65,14 @@ const (
6565 EnvHotPoll = "FN_HOT_POLL_MSECS"
6666 // EnvHotLauncherTimeout is the timeout for a hot container queue to persist if idle
6767 EnvHotLauncherTimeout = "FN_HOT_LAUNCHER_TIMEOUT_MSECS"
68- // EnvHotStartTimeout is the timeout for a hot container to be created including docker-pull
68+ // EnvHotPullTimeout is the timeout for a hot container to be created including docker-pull
6969 EnvHotPullTimeout = "FN_HOT_PULL_TIMEOUT_MSECS"
7070 // EnvHotStartTimeout is the timeout for a hot container to become available for use for requests after EnvHotStartTimeout
7171 EnvHotStartTimeout = "FN_HOT_START_TIMEOUT_MSECS"
7272 // EnvMaxResponseSize is the maximum number of bytes that a function may return from an invocation
7373 EnvMaxResponseSize = "FN_MAX_RESPONSE_SIZE"
74- // EnvHdrMaxResponseSize is the maximum number of bytes that a function may return in an invocation header
74+ // EnvMaxHdrResponseSize is the maximum number of bytes that a function may return in an invocation header
7575 EnvMaxHdrResponseSize = "FN_MAX_HDR_RESPONSE_SIZE"
76- // EnvMaxLogSize is the maximum size that a function's log may reach
77- EnvMaxLogSize = "FN_MAX_LOG_SIZE_BYTES"
7876 // EnvMaxTotalCPU is the maximum CPU that will be reserved across all containers
7977 EnvMaxTotalCPU = "FN_MAX_TOTAL_CPU_MCPUS"
8078 // EnvMaxTotalMemory is the maximum memory that will be reserved across all containers
@@ -100,6 +98,8 @@ const (
10098 EnvDisableReadOnlyRootFs = "FN_DISABLE_READONLY_ROOTFS"
10199 // EnvDisableDebugUserLogs disables user function logs being logged at level debug. wise to enable for production.
102100 EnvDisableDebugUserLogs = "FN_DISABLE_DEBUG_USER_LOGS"
101+ // EnvUserLogLevel is the logging level to use for user's function logs to be logged by fn. to disable explicitly, use FN_DISABLE_DEBUG_USER_LOGS
102+ EnvUserLogLevel = "FN_USER_LOG_LEVEL"
103103
104104 // EnvIOFSEnableTmpfs enables creating a per-container tmpfs mount for the IOFS
105105 EnvIOFSEnableTmpfs = "FN_IOFS_TMPFS"
@@ -134,7 +134,6 @@ const (
134134func NewConfig () (* Config , error ) {
135135 cfg := & Config {
136136 MinDockerVersion : "17.10.0-ce" ,
137- MaxLogSize : 1 * 1024 * 1024 ,
138137 PreForkImage : "busybox" ,
139138 PreForkCmd : "tail -f /dev/null" ,
140139 }
@@ -148,7 +147,6 @@ func NewConfig() (*Config, error) {
148147 err = setEnvMsecs (err , EnvDetachedHeadroom , & cfg .DetachedHeadRoom , time .Duration (360 )* time .Second )
149148 err = setEnvUint (err , EnvMaxResponseSize , & cfg .MaxResponseSize )
150149 err = setEnvUint (err , EnvMaxHdrResponseSize , & cfg .MaxHdrResponseSize )
151- err = setEnvUint (err , EnvMaxLogSize , & cfg .MaxLogSize )
152150 err = setEnvUint (err , EnvMaxTotalCPU , & cfg .MaxTotalCPU )
153151 err = setEnvUint (err , EnvMaxTotalMemory , & cfg .MaxTotalMemory )
154152 err = setEnvUint (err , EnvMaxFsSize , & cfg .MaxFsSize )
@@ -168,6 +166,7 @@ func NewConfig() (*Config, error) {
168166 err = setEnvBool (err , EnvEnableNBResourceTracker , & cfg .EnableNBResourceTracker )
169167 err = setEnvBool (err , EnvDisableReadOnlyRootFs , & cfg .DisableReadOnlyRootFs )
170168 err = setEnvBool (err , EnvDisableDebugUserLogs , & cfg .DisableDebugUserLogs )
169+ err = setEnvStr (err , EnvUserLogLevel , & cfg .UserLogLevel )
171170 err = setEnvUint (err , EnvImageCleanMaxSize , & cfg .ImageCleanMaxSize )
172171 err = setEnvStr (err , EnvImageCleanExemptTags , & cfg .ImageCleanExemptTags )
173172 err = setEnvBool (err , EnvImageEnableVolume , & cfg .ImageEnableVolume )
@@ -176,11 +175,6 @@ func NewConfig() (*Config, error) {
176175 return cfg , err
177176 }
178177
179- if cfg .MaxLogSize > math .MaxInt64 {
180- // for safety during uint64 to int conversions in Write()/Read(), etc.
181- return cfg , fmt .Errorf ("error invalid %s %v > %v" , EnvMaxLogSize , cfg .MaxLogSize , math .MaxInt64 )
182- }
183-
184178 return cfg , nil
185179}
186180
0 commit comments