I am using caddy 2 as my proxy. and I try to set my caddy log format.
localhost:80 {
reverse_proxy example:80
log {
output net logstash:5140
format single_field common_log
}
}
on version 1 there are predefined format https://caddyserver.com/v1/docs/log (from old version) common_log and combined
however this config below doesn't work. I assumed, it is deprecated, like it is stated in their documentation.
localhost:80 {
reverse_proxy example:80
log {
output net logstash:5140
format single_field combined_log
}
}
But, I would like to keep using the old format for the log instead of the json format. then i tried multiple format, but it is not really documented in their website, also couldn't find in the community forum either.
then i tried multiple solutions. but, it is not working.
localhost:80 {
reverse_proxy example:80
log {
output net logstash:5140
format single_field "{remote} - {user} [{when}] \"{method} {uri} {proto}\" {status} {size} \"{>Referer}\" \"{>User-Agent}\""
}
}
Can someone help me out? What I expected ist, the format look like this.
"127.0.0.1 - - [10/Apr/2020:14:10:12 +0000] \"localhost\" \"GET / HTTP/1.1\" 200 236 \"-\" \"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0\""
And common_log giving me output
"10.0.0.2 - - [11/Apr/2020:08:50:01 +0000] \"GET / HTTP/1.1\" 200 236\n"
custom input
format single_field "{remote} - {user} [{when}] \"{method} {uri} {proto}\" {status} {size} \"{>Referer}\" \"{>User-Agent}\""
"45.143.220.111 - - [11/Apr/2020:09:00:20 +0000] \"127.0.0.1\" \"GET /vtigercrm/vtigerservice.php HTTP/1.1\" 444 0 \"-\" \"libwww-perl/6.43\""
"45.143.220.111 - - [11/Apr/2020:09:00:20 +0000] \"_\" \"\\x16\\x03\\x01\\x02\\x00\\x01\\x00\\x01\\xFC\\x03\\x03\\x97s\\xD21\\x91\\xF6\\x88;\\x05\\x9C\\xFEs\\x99\\xB4\\x06\\xB6\\xC07Jd.aLC\\x9AR\\xE6\\x07\\x09\\x98\\xD6\\x1F\\x00\\x00\\xAC\\xC00\\xC0,\\xC0(\\xC0$\\xC0\\x14\\xC0\" 400 157 \"-\" \"-\""