summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2022-04-05 20:51:50 +0200
committerValery Piashchynski <[email protected]>2022-04-05 20:51:50 +0200
commit7834636158f26aaa7e8f61d585fc2d7b9392fbc3 (patch)
tree7be44246dd78e1310335e2d0f2947afc152a05fe
parent08b74400f5ebd75bd33af12c645a38fb38b73c79 (diff)
config: add file logger options to the `.rr.yaml` and schema2.0.json
Signed-off-by: Valery Piashchynski <[email protected]>
-rw-r--r--.rr.yaml30
-rw-r--r--go.mod4
-rw-r--r--go.sum5
-rw-r--r--schemas/config/2.0.schema.json26
4 files changed, 63 insertions, 2 deletions
diff --git a/.rr.yaml b/.rr.yaml
index 5c6c7b62..d54bc068 100644
--- a/.rr.yaml
+++ b/.rr.yaml
@@ -109,6 +109,36 @@ logs:
# Default: "stderr"
err_output: stderr
+ # File logger options
+ #
+ # Default: null
+ file_logger_options:
+
+ # Path to the file
+ #
+ # Default: It uses <processname>-lumberjack.log name in the os tempdir if empty.
+ log_output: "/tmp/my.log"
+
+ # Max file size in MB
+ #
+ # Default: 100
+ max_size: 100
+
+ # max_age is the maximum number of days to retain old log files based on the timestamp encoded in their filename.
+ #
+ # Default: 1 (day)
+ max_age: 1
+
+ # max_backups is the maximum number of old log files to retain.
+ #
+ # Default: retain all (if set to 0)
+ max_backups : 5
+
+ # Compress determines if the rotated log files should be compressed using gzip.
+ #
+ # Default: false
+ compress: false
+
# You can configure each plugin log messages individually (key is plugin name, and value is logging options in same
# format as above).
#
diff --git a/go.mod b/go.mod
index dbe252e6..f65e5f82 100644
--- a/go.mod
+++ b/go.mod
@@ -138,7 +138,7 @@ require (
github.com/twmb/murmur3 v1.1.6 // indirect
github.com/uber-go/tally/v4 v4.1.1 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
- github.com/valyala/fasthttp v1.34.0 // indirect
+ github.com/valyala/fasthttp v1.35.0 // indirect
github.com/valyala/tcplisten v1.0.0 // indirect
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
@@ -154,7 +154,7 @@ require (
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 //indirect
golang.org/x/net v0.0.0-20220403103023-749bd193bc2b // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
- golang.org/x/sys v0.0.0-20220403205710-6acee93ad0eb // indirect
+ golang.org/x/sys v0.0.0-20220405052023-b1e9470b6e64 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect
golang.org/x/tools v0.1.10 // indirect
diff --git a/go.sum b/go.sum
index 873ebc64..c45e861c 100644
--- a/go.sum
+++ b/go.sum
@@ -95,6 +95,7 @@ github.com/caddyserver/certmagic v0.16.0/go.mod h1:jKQ5n+ViHAr6DbPwEGLTSM2vDwTO6
github.com/cenkalti/backoff/v4 v4.1.2 h1:6Yo7N8UP2K6LWZnW94DLVSSrbobcWdVzAYOisuDPIFo=
github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
+github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=
@@ -498,6 +499,8 @@ github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6Kllzaw
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasthttp v1.34.0 h1:d3AAQJ2DRcxJYHm7OXNXtXt2as1vMDfxeIcFvhmGGm4=
github.com/valyala/fasthttp v1.34.0/go.mod h1:epZA5N+7pY6ZaEKRmstzOuYJx9HI8DI1oaCGZpdH4h0=
+github.com/valyala/fasthttp v1.35.0 h1:wwkR8mZn2NbigFsaw2Zj5r+xkmzjbrA/lyTmiSlal/Y=
+github.com/valyala/fasthttp v1.35.0/go.mod h1:t/G+3rLek+CyY9bnIE+YlMRddxVAAGjhxndDB4i4C0I=
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
github.com/vbauerster/mpb/v5 v5.4.0 h1:n8JPunifvQvh6P1D1HAl2Ur9YcmKT1tpoUuiea5mlmg=
@@ -723,6 +726,8 @@ golang.org/x/sys v0.0.0-20220222200937-f2425489ef4c/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220403205710-6acee93ad0eb h1:PVGECzEo9Y3uOidtkHGdd347NjLtITfJFO9BxFpmRoo=
golang.org/x/sys v0.0.0-20220403205710-6acee93ad0eb/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220405052023-b1e9470b6e64 h1:D1v9ucDTYBtbz5vNuBbAhIMAGhQhJ6Ym5ah3maMVNX4=
+golang.org/x/sys v0.0.0-20220405052023-b1e9470b6e64/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
diff --git a/schemas/config/2.0.schema.json b/schemas/config/2.0.schema.json
index 344f77a4..9a444c7d 100644
--- a/schemas/config/2.0.schema.json
+++ b/schemas/config/2.0.schema.json
@@ -168,6 +168,32 @@
}
}
}
+ },
+ "file_logger_options": {
+ "description": "file logger options",
+ "type": "object",
+ "properties": {
+ "log_output": {
+ "type": "string",
+ "description": "path to the file"
+ },
+ "max_size": {
+ "type": "integer",
+ "description": "maximum file size in MB"
+ },
+ "max_age": {
+ "type": "integer",
+ "description": "The maximum number of days to retain old log files based on the timestamp encoded in their filename"
+ },
+ "max_backups" : {
+ "type": "integer",
+ "description": "The maximum number of old log files to retain"
+ },
+ "compress" : {
+ "type": "boolean",
+ "description": "compress files to save a disk space"
+ }
+ }
}
}
},