forked from codegangsta/caddy-nats
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FEATURE: Log access logs directly to NATS
- Loading branch information
1 parent
94669d2
commit cbb5282
Showing
9 changed files
with
561 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# run with: ./caddy run --config Caddyfile | ||
|
||
{ | ||
nats { | ||
url 127.0.0.1:4222 | ||
clientName "My Caddy Server" | ||
} | ||
} | ||
|
||
http://127.0.0.1:8888 { | ||
log { | ||
output nats my.log.subject | ||
} | ||
respond "Hello World" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
# detect location of XCADDY | ||
XCADDY=xcaddy | ||
if [ -f ~/go/bin/xcaddy ]; then | ||
XCADDY=~/go/bin/xcaddy | ||
fi | ||
|
||
# build caddy server if needed | ||
if [ ! -f caddy ]; then | ||
go get -u github.com/sandstorm/caddy-nats-bridge | ||
$XCADDY build --with github.com/sandstorm/caddy-nats-bridge | ||
fi | ||
|
||
nats-server & | ||
sleep 1 | ||
trap 'killall nats-server' EXIT | ||
|
||
./caddy run --config Caddyfile | ||
|
55 changes: 55 additions & 0 deletions
55
integrationtest/caddyfile_adapt/logoutput_explicitServerAlias.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
localhost { | ||
log { | ||
output nats server2 my.topic.foo.bar | ||
} | ||
} | ||
---------- | ||
{ | ||
"logging": { | ||
"logs": { | ||
"default": { | ||
"exclude": [ | ||
"http.log.access.log0" | ||
] | ||
}, | ||
"log0": { | ||
"writer": { | ||
"output": "nats", | ||
"serverAlias": "server2", | ||
"subject": "my.topic.foo.bar" | ||
}, | ||
"include": [ | ||
"http.log.access.log0" | ||
] | ||
} | ||
} | ||
}, | ||
"apps": { | ||
"http": { | ||
"servers": { | ||
"srv0": { | ||
"listen": [ | ||
":443" | ||
], | ||
"routes": [ | ||
{ | ||
"match": [ | ||
{ | ||
"host": [ | ||
"localhost" | ||
] | ||
} | ||
], | ||
"terminal": true | ||
} | ||
], | ||
"logs": { | ||
"logger_names": { | ||
"localhost": "log0" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
localhost { | ||
log { | ||
output nats my.topic.foo.bar | ||
} | ||
} | ||
---------- | ||
{ | ||
"logging": { | ||
"logs": { | ||
"default": { | ||
"exclude": [ | ||
"http.log.access.log0" | ||
] | ||
}, | ||
"log0": { | ||
"writer": { | ||
"output": "nats", | ||
"serverAlias": "default", | ||
"subject": "my.topic.foo.bar" | ||
}, | ||
"include": [ | ||
"http.log.access.log0" | ||
] | ||
} | ||
} | ||
}, | ||
"apps": { | ||
"http": { | ||
"servers": { | ||
"srv0": { | ||
"listen": [ | ||
":443" | ||
], | ||
"routes": [ | ||
{ | ||
"match": [ | ||
{ | ||
"host": [ | ||
"localhost" | ||
] | ||
} | ||
], | ||
"terminal": true | ||
} | ||
], | ||
"logs": { | ||
"logger_names": { | ||
"localhost": "log0" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.