Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 11, 01:00 UTC
| 1 | (log-both) { |
| 2 | log {args[0]}-json { |
| 3 | hostnames {args[0]} |
| 4 | output file /var/log/{args[0]}.log |
| 5 | format json |
| 6 | } |
| 7 | log {args[0]}-console { |
| 8 | hostnames {args[0]} |
| 9 | output file /var/log/{args[0]}.json |
| 10 | format console |
| 11 | } |
| 12 | } |
| 13 | |
| 14 | *.example.com { |
| 15 | # Subdomains log to multiple files at once, with |
| 16 | # different output files and formats. |
| 17 | import log-both foo.example.com |
| 18 | import log-both bar.example.com |
| 19 | } |
| 20 | ---------- |
| 21 | { |
| 22 | "logging": { |
| 23 | "logs": { |
| 24 | "bar.example.com-console": { |
| 25 | "writer": { |
| 26 | "filename": "/var/log/bar.example.com.json", |
| 27 | "output": "file" |
| 28 | }, |
| 29 | "encoder": { |
| 30 | "format": "console" |
| 31 | }, |
| 32 | "include": [ |
| 33 | "http.log.access.bar.example.com-console" |
| 34 | ] |
| 35 | }, |
| 36 | "bar.example.com-json": { |
| 37 | "writer": { |
| 38 | "filename": "/var/log/bar.example.com.log", |
| 39 | "output": "file" |
| 40 | }, |
| 41 | "encoder": { |
| 42 | "format": "json" |
| 43 | }, |
| 44 | "include": [ |
| 45 | "http.log.access.bar.example.com-json" |
| 46 | ] |
| 47 | }, |
| 48 | "default": { |
| 49 | "exclude": [ |
| 50 | "http.log.access.bar.example.com-console", |
| 51 | "http.log.access.bar.example.com-json", |
| 52 | "http.log.access.foo.example.com-console", |
| 53 | "http.log.access.foo.example.com-json" |
| 54 | ] |
| 55 | }, |
| 56 | "foo.example.com-console": { |
| 57 | "writer": { |
| 58 | "filename": "/var/log/foo.example.com.json", |
| 59 | "output": "file" |
| 60 | }, |
| 61 | "encoder": { |
| 62 | "format": "console" |
| 63 | }, |
| 64 | "include": [ |
| 65 | "http.log.access.foo.example.com-console" |
| 66 | ] |
| 67 | }, |
| 68 | "foo.example.com-json": { |
| 69 | "writer": { |
| 70 | "filename": "/var/log/foo.example.com.log", |
| 71 | "output": "file" |
| 72 | }, |
| 73 | "encoder": { |
| 74 | "format": "json" |
| 75 | }, |
| 76 | "include": [ |
| 77 | "http.log.access.foo.example.com-json" |
| 78 | ] |
| 79 | } |
| 80 | } |
| 81 | }, |
| 82 | "apps": { |
| 83 | "http": { |
| 84 | "servers": { |
| 85 | "srv0": { |
| 86 | "listen": [ |
| 87 | ":443" |
| 88 | ], |
| 89 | "routes": [ |
| 90 | { |
| 91 | "match": [ |
| 92 | { |
| 93 | "host": [ |
| 94 | "*.example.com" |
| 95 | ] |
| 96 | } |
| 97 | ], |
| 98 | "terminal": true |
| 99 | } |
| 100 | ], |
| 101 | "logs": { |
| 102 | "logger_names": { |
| 103 | "bar.example.com": [ |
| 104 | "bar.example.com-json", |
| 105 | "bar.example.com-console" |
| 106 | ], |
| 107 | "foo.example.com": [ |
| 108 | "foo.example.com-json", |
| 109 | "foo.example.com-console" |
| 110 | ] |
| 111 | } |
| 112 | } |
| 113 | } |
| 114 | } |
| 115 | } |
| 116 | } |
| 117 | } |