diff options
| author | Jelmer Vernooij <jelmer@jelmer.uk> | 2015-09-27 15:03:39 +0000 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2015-09-28 18:45:17 -0400 |
| commit | 842428cb4db77b0b9dd314d043058cb3d32fbb0f (patch) | |
| tree | 0841358aa71d9ef0a6aaa00f3fb840d8bf0318a3 /src | |
| parent | cd44c61aa104f2d36b9834b143296b74b33e226f (diff) | |
Add Logcheck module.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Propellor/Property/Logcheck.hs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/Propellor/Property/Logcheck.hs b/src/Propellor/Property/Logcheck.hs new file mode 100644 index 00000000..83045dcc --- /dev/null +++ b/src/Propellor/Property/Logcheck.hs @@ -0,0 +1,33 @@ +module Propellor.Property.Logcheck ( + ReportLevel (Workstation, Server, Paranoid), + defaultPrefix, + ignoreFilePath, + ignoreLines, + installed, +) where + +import Propellor +import qualified Propellor.Property.Apt as Apt +import qualified Propellor.Property.File as File + +data ReportLevel = Workstation | Server | Paranoid +type Service = String + +instance Show ReportLevel where + show Workstation = "workstation" + show Server = "server" + show Paranoid = "paranoid" + +-- The common prefix used by default in syslog lines. +defaultPrefix :: String +defaultPrefix = "^\\w{3} [ :[:digit:]]{11} [._[:alnum:]-]+ " + +ignoreFilePath :: ReportLevel -> Service -> FilePath +ignoreFilePath t n = "/etc/logcheck/ignore.d." ++ (show t) </> n + +ignoreLines :: ReportLevel -> Service -> [String] -> Property NoInfo +ignoreLines t n ls = (ignoreFilePath t n) `File.containsLines` ls + `describe` ("logcheck ignore lines for " ++ n ++ "(" ++ (show t) ++ ")") + +installed :: Property NoInfo +installed = Apt.installed ["logcheck"] |
