Don't log lines with specific user agent

(Aleks) #1

I use the latest caddy server and have the following log line in my config

log / stdout "app-dev: {remote} {>X-Bb-Ip} {user} [{when}] \"{method} {uri} {proto}\" {status} {size} \"{>Referer}\" \"{>User-Agent}\""

Now when pingdom checks the availability I don’t want to have this in my logs

Apr 11 10:10:11 caddy[22113]: app-dev: - - [11/Apr/2018:10:10:11 +0200] “GET /index.php?func=register HTTP/1.1” 200 4905 “-” “Pingdom.com_bot_version_1.4_(”

In the http.log module is the keyword exceptonly for paths is there another possibility do not log this line or should I open a RFE (=Request for enhancement) to add such a feature?

(Matthew Fay) #2

Yeah, sounds like a candidate for a feature request on the Github repo.

I don’t know how much traction it will get, though - just about every log viewing tool in existence has very simple methods to exclude arbitrary lines from its output (e.g. grep -v "Pingdom.com_bot"), and it can be stripped out after the fact equally as easily, so there’s not much need to exclude this data at the collection stage.

(Matt Holt) #3

This would be covered by I think.

(Matthew Fay) #4

Definitely, if-scoped directives would solve this via hypothetical {>User-Agent} not_starts_with "Pingdom.com_bot" check, when that PR is finalised.

(system) #5

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.