packages feed

hnormalise 0.3.3.0 → 0.4.1.0

raw patch · 37 files changed

+1504/−91 lines, 37 filesdep +lifted-basedep +monad-controldep +monad-loopsdep ~basesetup-changednew-component:exe:hnormalise-0mq

Dependencies added: lifted-base, monad-control, monad-loops, mtl, transformers-base, unix, zeromq4-conduit, zeromq4-haskell

Dependency ranges changed: base

Files

+ 0mq/Main.hs view
@@ -0,0 +1,62 @@+module Main where++import System.Posix.Signals (installHandler, Handler(Catch), Handler(CatchOnce), sigINT, sigTERM)+import Control.Concurrent.MVar (modifyMVar_, newMVar, withMVar, tryTakeMVar, putMVar, MVar, newEmptyMVar)++import System.ZMQ4+import Debug.Trace++handler :: MVar () -> Handler+handler s_interrupted = CatchOnce $ trace "modifying" $ putMVar s_interrupted ()++main :: IO ()+main = do+    withContext $ \ctx -> do+        withSocket ctx Pull $ \socket -> do+            bind socket "tcp://*:5555"+            s_interrupted <- newEmptyMVar+            installHandler sigINT (handler s_interrupted) Nothing+            installHandler sigTERM (handler s_interrupted) Nothing+            recvFunction s_interrupted socket+        trace "outside withSocket" $ return ()+    trace "outside withContext" $ return ()+++recvFunction :: (Receiver b) => MVar () -> Socket b -> IO ()+recvFunction mi sock = do+    msg <- receive sock+    putStrLn $ "message received: " ++ show msg+    val <- tryTakeMVar mi+    case val of+        Just _  -> putStrLn "W: Interrupt received. Killing Server"+        Nothing -> recvFunction mi sock+{-}    withMVar mi (\val -> if val > 0+        then  putStrLn "W: Interrupt Received. Killing Server"+        else  recvFunction mi sock)+-}+{-++import System.Posix.Signals+import Control.Concurrent (threadDelay)+import Control.Concurrent.MVar++termHandler :: MVar () -> Handler+termHandler v = CatchOnce $ do+    putStrLn "Caught SIGTERM"+    putMVar v ()++loop :: MVar () -> IO ()+loop v = do+    putStrLn "Still running"+    threadDelay 1000000+    val <- tryTakeMVar v+    case val of+        Just _ -> putStrLn "Quitting" >> return ()+        Nothing -> loop v++main = do+    v <- newEmptyMVar+    installHandler sigTERM (termHandler v) Nothing+    loop v⏎++-}
LICENSE view
@@ -1,4 +1,4 @@-Copyright Author name here (c) 2017+Copyright Andy Georges (c) 2017  All rights reserved. 
README.md view
@@ -8,12 +8,13 @@  Features: +- accepts incoming data on a regular TCP port or a ZeroMQ `pull` type port. - accepts JSON-style rsyslog data (sent as %jsonmesg% in the rsyslog template) - accepts legacy encoded rsyslog data (currently sent with the fixed template   <%PRI%>1 %TIMEGENERATED% %HOSTNAME% %SYSLOGTAG% - %APPNAME%: %msg%)-- sends out successfull converted results on a TCP port, allowing communication back to a wide range of services,+- sends out successfull converted results on a TCP or ZeroMQ port, allowing communication back to a wide range of services,   including rsyslog, [logstash](http://www.elastic.co/products/logstash), ...-- sends out original messages to a (different) TCP port in case the parsing fails, allowing other services to process the+- sends out original messages to a (different) TCP or ZeroMQ port in case the parsing fails, allowing other services to process the   information.  Usage and configuration@@ -24,11 +25,13 @@ To run the included benchmarks, run `stack bench` (with the `--output target.html` flag to get a nice web page with the results). -Ports and machines can be tweaked through a configuration file. See `data/hnormalise.yaml` for an example.+Ports and machines can be tweaked through a configuration file. See `data/hnormalise.yaml.full` for an example.  Testing the actual setup can be done trivially via `nc`, provided you have data to throw at `hNormalise`. A test example is also provided below, or you can get useful examples from the tests, under `test/HNormalise/*/ParserSpec.hs` +For ZeroMQ, the development libraries for czmq are required. We use ZeroMQ >= 4.1.+ Supported log messages ---------------------- @@ -36,6 +39,7 @@ - [Torque](http://www.adaptivecomputing.com/products/open-source/torque/) accounting logs for a job exit. - [Shorewall](http://shorewall.org) firewall log messages for TCP, UDP and ICMP connections - [Lmod](https://www.tacc.utexas.edu/research-development/tacc-projects/lmod) module load messages+- [Snoopy](https://github.com/a2o/snoopy) log messages  More are forthcoming soon, e.g., (in no particular order) - GPFS@@ -43,7 +47,6 @@ - NFS - OpenNebula - SSH-- Snoopy - Jube  Parsing@@ -57,6 +60,7 @@  Caveat: at this point, we do not a priori restrict the possible parsers we unleash on each message. However, if the inbound data can be tagged properly, we could reduce the maximal number of parsers tried and avoid extensive backtracking.+Using ZeroMQ, this could be done by using topics to tag inbound information.  ### Adding a new parser @@ -160,6 +164,14 @@               },               "energy" : 0             },+            "execHost": [+              {+                "name": "exec_host=mynode.mycluster.mydomain.com",+                "cores": [+                  1+                ]+              }+            ],             "resourceRequest" : {               "neednodes" : {                 "Right" : [
Setup.hs view
@@ -1,2 +1,36 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+ import Distribution.Simple main = defaultMain
app/Main.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE FlexibleContexts  #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards   #-} @@ -5,8 +6,11 @@  -------------------------------------------------------------------------------- import           Control.Applicative          ((<$>), (<*>))+import           Control.Concurrent.MVar      (modifyMVar_, newMVar, newEmptyMVar, putMVar, readMVar, tryTakeMVar, withMVar, MVar) import           Control.Monad import           Control.Monad.IO.Class       (MonadIO, liftIO)+import           Control.Monad.Loops          (whileM_, untilM_)+import           Control.Monad.Trans          (lift) import           Control.Monad.Trans.Resource (runResourceT) import           Data.Aeson import           Data.Attoparsec.Text@@ -18,19 +22,33 @@ import qualified Data.Conduit.Combinators     as C import           Data.Conduit.Network import qualified Data.Conduit.Text            as DCT+import qualified Data.Conduit.ZMQ4            as ZMQC import           Data.Maybe                   (fromJust)-import           Data.Monoid                  (mempty, (<>))+import           Data.Monoid                  ((<>)) import qualified Data.Text                    as T import qualified Data.Text.Encoding           as TE import           Data.Version                 (showVersion) import qualified Options.Applicative          as OA import qualified Paths_hnormalise import           System.Exit                  (exitFailure, exitSuccess)+import           System.Posix.Signals         (installHandler, Handler(CatchOnce), sigINT, sigTERM)+import qualified System.ZMQ4                  as ZMQ (Receiver, Sender, Socket, Size, context, term, setIoThreads, Context)+import qualified System.ZMQ4                  as ZMQ (withContext, withSocket, bind, send, receive, connect, Push(..), Pull(..))+import           Text.Printf                  (printf)  import           Debug.Trace -------------------------------------------------------------------------------- import           HNormalise-import           HNormalise.Config            (Config (..), PortConfig(..), loadConfig)+import           HNormalise.Config            ( Config (..)+                                              , ConnectionType(..)+                                              , InputConfig(..)+                                              , OutputConfig(..)+                                              , TcpOutputConfig(..)+                                              , TcpPortConfig(..)+                                              , ZeroMQOutputConfig(..)+                                              , ZeroMQPortConfig(..)+                                              , connectionType+                                              , loadConfig) import           HNormalise.Internal          (Rsyslog (..)) import           HNormalise.Json @@ -75,6 +93,13 @@     )  --------------------------------------------------------------------------------+-- | 'handler' will catch SIGTERM and modify the MVar to allow the upstream+-- connection to be closed cleanly when using ZeroMQ. Code taken from+-- http://zguide.zeromq.org/hs:interrupt+handler :: MVar () -> IO ()+handler s_interrupted = trace "Interrupt received" $ putMVar s_interrupted ()++-------------------------------------------------------------------------------- -- | 'messageSink' yields the parsed JSON downstream, or if parsing fails, yields the original message downstream messageSink success failure = loop   where@@ -82,12 +107,12 @@         v <- await         case v of             Just (Transformed json) -> do-                yield json $$ appSink success-                yield (SBS.pack "\n") $$ appSink success+                yield json $$ success+                yield (SBS.pack "\n") $$ success                 loop             Just (Original l) -> do-                yield l $$ appSink failure-                yield (SBS.pack "\n") $$ appSink failure+                yield l $$ failure+                yield (SBS.pack "\n") $$ failure                 loop             Nothing -> return () @@ -101,19 +126,107 @@         v <- await         case v of             Just (Transformed json) -> do-                yield (SBS.pack "success: ")+                trace "successfull parse" $ yield (SBS.pack "success: ")                 yield json                 yield (SBS.pack "\n")                 loop             Just (Original l) -> do-                yield (SBS.pack "fail - original: ")+                trace "failed parse" $ yield (SBS.pack "fail - original: ")                 yield l                 yield (SBS.pack "\n")                 loop             Nothing -> return () +--------------------------------------------------------------------------------+runTCPConnection options config = do+    let listenHost = fromJust $ input config >>= (\(InputConfig t _) -> t) >>= (\(TcpPortConfig h p) -> h)+    let listenPort = fromJust $ input config >>= (\(InputConfig t _) -> t) >>= (\(TcpPortConfig h p) -> p)+    runTCPServer (serverSettings listenPort "*") $ \appData -> do+        let fs = fields config+        case oTestFilePath options of+            Nothing -> do+                let successHost = TE.encodeUtf8 $ fromJust $ output config >>= (\(OutputConfig t _) -> t) >>= (\(TcpOutputConfig s f) -> s) >>= (\(TcpPortConfig h p) -> h)+                let successPort = fromJust $ output config >>= (\(OutputConfig t _) -> t) >>= (\(TcpOutputConfig s f) -> s) >>= (\(TcpPortConfig h p) -> p)+                let failureHost = TE.encodeUtf8 $ fromJust $ output config >>= (\(OutputConfig t _) -> t) >>= (\(TcpOutputConfig s f) -> f) >>= (\(TcpPortConfig h p) -> h)+                let failurePort = fromJust $ output config >>= (\(OutputConfig t _) -> t) >>= (\(TcpOutputConfig s f) -> f) >>= (\(TcpPortConfig h p) -> p) +                runTCPClient (clientSettings successPort successHost) $ \successServer ->+                    runTCPClient (clientSettings failurePort failureHost) $ \failServer ->+                        let normalisationConduit = case oJsonInput options of+                                                        True  -> CB.lines $= C.map (normaliseJsonInput fs)+                                                        False -> DCT.decode DCT.utf8 $= DCT.lines $= C.map (normaliseText fs)+                        in appSource appData+                            $= normalisationConduit+                            $$ messageSink (appSink successServer) (appSink failServer)+            Just testSinkFileName ->+                let normalisationConduit = case oJsonInput options of+                                                True  -> CB.lines $= C.map (normaliseJsonInput fs)+                                                False -> DCT.decode DCT.utf8 $= DCT.lines $= C.map (normaliseText fs)+                in runResourceT $ appSource appData+                    $= normalisationConduit+                    $= mySink+                    $$ sinkFile testSinkFileName++-- | 'zmqInterruptibleSource' converts a regular 0mq recieve operation on a socket into a conduit source+-- The source is halted when something is put into the MVar, effectively stopping the program from checking+-- for new incoming messages.+zmqInterruptibleSource m s = do+    whileM_+        (liftIO $ do+            val <- tryTakeMVar m+            case val of+                Just _ ->  trace "interrupt received, stopping source" $ return False+                Nothing -> trace "still going ..." $ return True)+        (lift (ZMQ.receive s) >>= yield)+    liftIO $ putStrLn "Done!"+ --------------------------------------------------------------------------------+runZeroMQConnection options config s_interrupted = do+    let fs = fields config+    let listenHost = fromJust $ input config >>= (\(InputConfig _ z) -> z) >>= (\(ZeroMQPortConfig m h p) -> h)+    let listenPort = fromJust $ input config >>= (\(InputConfig _ z) -> z) >>= (\(ZeroMQPortConfig m h p) -> p)+    trace (printf "listening on tcp://%s:%d" listenHost listenPort) $ return ()++    case oTestFilePath options of+        Nothing -> do+            ZMQ.withContext $ \ctx -> do+                ZMQ.withSocket ctx ZMQ.Pull $ \s -> do+                    ZMQ.bind s $ printf "tcp://%s:%d" listenHost listenPort++                    let successHost = fromJust $ output config >>= (\(OutputConfig _ z) -> z) >>= (\(ZeroMQOutputConfig s f) -> s) >>= (\(ZeroMQPortConfig m h p) -> h)+                    let successPort = fromJust $ output config >>= (\(OutputConfig _ z) -> z) >>= (\(ZeroMQOutputConfig s f) -> s) >>= (\(ZeroMQPortConfig m h p) -> p)+                    let failureHost = fromJust $ output config >>= (\(OutputConfig _ z) -> z) >>= (\(ZeroMQOutputConfig s f) -> f) >>= (\(ZeroMQPortConfig m h p) -> h)+                    let failurePort = fromJust $ output config >>= (\(OutputConfig _ z) -> z) >>= (\(ZeroMQOutputConfig s f) -> f) >>= (\(ZeroMQPortConfig m h p) -> p)++                    ZMQ.withSocket ctx ZMQ.Push $ \successSocket ->+                      ZMQ.withSocket ctx ZMQ.Push $ \failureSocket -> do+                        ZMQ.connect successSocket $ printf "tcp://%s:%d" successHost successPort+                        trace (printf "connected to tcp://%s:%d" successHost successPort) $ return ()+                        ZMQ.connect failureSocket $ printf "tcp://%s:%d"  failureHost failurePort+                        trace (printf "connected to tcp://%s:%d" failureHost failurePort) $ return ()++                        let normalisationConduit = case oJsonInput options of+                                                        True  -> CB.lines $= C.map (normaliseJsonInput fs)+                                                        False -> DCT.decode DCT.utf8 $= DCT.lines $= C.map (normaliseText fs)+                        liftIO $ zmqInterruptibleSource s_interrupted s+                            $= normalisationConduit+                            $$ messageSink (ZMQC.zmqSink successSocket []) (ZMQC.zmqSink failureSocket [])++        {-Just testSinkFileName ->+            let normalisationConduit = case oJsonInput options of+                                            True  -> CB.lines $= C.map (normaliseJsonInput fs)+                                            False -> DCT.decode DCT.utf8 $= DCT.lines $= C.map (normaliseText fs)++            in ZMQ.withContext $ \ctx -> do+                    ZMQ.withSocket ctx ZMQ.Pull $ \s -> do+                        ZMQ.bind s $ printf "tcp://%s:%d" listenHost listenPort+                        liftIO $ zmqInterruptibleSource s_interrupted s+                            $= normalisationConduit+                            $= mySink+                            $$ sinkFile testSinkFileName+-}++-------------------------------------------------------------------------------- -- | 'main' starts a TCP server, listening to incoming data and connecting to TCP servers downstream to -- for the pipeline. main :: IO ()@@ -125,34 +238,19 @@         exitSuccess      config <- loadConfig (oConfigFilePath options)-    trace (show config) $ return ()+    --trace (show config) $ return ()+    -- install the signal handlers for a clean shutdown -    let lHost = case ports config >>= listenHost of-                    Just h  -> T.unpack h-                    Nothing -> "*" -    let fs = fields config--    runTCPServer (serverSettings (fromJust $ (ports config >>= listenPort)) "*") $ \appData -> do+    -- For now, we only support input and output configurations of the same type,+    -- i.e., both TCP, both ZeroMQ, etc.+    case connectionType config of+        TCP    -> void $ runTCPConnection options config+        ZeroMQ -> do+            trace "zeromq" $ return ()+            s_interrupted <- newEmptyMVar+            installHandler sigINT (CatchOnce $ handler s_interrupted) Nothing+            installHandler sigTERM (CatchOnce $ handler s_interrupted) Nothing+            runZeroMQConnection options config s_interrupted -        case oTestFilePath options of-            Nothing ->-                runTCPClient (clientSettings (fromJust $ ports config >>= successPort) "localhost") $ \successServer ->-                runTCPClient (clientSettings (fromJust $ ports config >>= failPort) "localhost") $ \failServer ->-                    case oJsonInput options of-                        True  -> appSource appData-                                    $= CB.lines-                                    $= C.map (normaliseJsonInput fs)-                                    $$ messageSink successServer failServer-                        False -> appSource appData-                                    $= DCT.decode DCT.utf8-                                    $= DCT.lines-                                    $= C.map (normaliseText fs)-                                    $$ messageSink successServer failServer-            Just testSinkFileName ->-                runResourceT $ appSource appData-                    $= (case oJsonInput options of-                        True  -> CB.lines $= C.map (normaliseJsonInput fs)-                        False -> DCT.decode DCT.utf8 $= DCT.lines $= C.map (normaliseText fs))-                    $= mySink-                    $$ sinkFile testSinkFileName+    exitSuccess
hnormalise.cabal view
@@ -1,5 +1,5 @@ name:                hnormalise-version:             0.3.3.0+version:             0.4.1.0 synopsis:            Log message normalisation tool producing structured JSON messages description:         Log message normalisation tool producing structured JSON messages homepage:            https://github.com/itkovian/hnormalise#readme@@ -71,13 +71,53 @@                      , containers                      , directory                      , ip+                     , monad-loops+                     , mtl                      , optparse-applicative                      , resourcet                      , text                      , time+                     , unix                      , word8                      , yaml+                     , zeromq4-haskell+                     , zeromq4-conduit+                     , lifted-base+                     , monad-control+                     , transformers-base   default-language:    Haskell2010+++executable hnormalise-0mq+  hs-source-dirs:      0mq+  main-is:             Main.hs+  ghc-options:         -threaded -rtsopts -with-rtsopts=-N -funbox-strict-fields -optc-O2+  build-depends:       base+                     , hnormalise+                     , aeson+                     , aeson-pretty+                     , attoparsec+                     , attoparsec-iso8601+                     , bytestring+                     , conduit+                     , conduit-combinators+                     , conduit-extra+                     , containers+                     , directory+                     , ip+                     , monad-loops+                     , mtl+                     , optparse-applicative+                     , resourcet+                     , text+                     , time+                     , unix+                     , word8+                     , yaml+                     , zeromq4-haskell+                     , zeromq4-conduit+  default-language:    Haskell2010+  test-suite hnormalise-test   type:                exitcode-stdio-1.0
src/HNormalise.hs view
@@ -1,3 +1,38 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}++ {-# LANGUAGE OverloadedStrings #-}  
src/HNormalise/Common/Internal.hs view
@@ -1,3 +1,37 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+ {-# LANGUAGE DeriveGeneric             #-} {-# LANGUAGE DuplicateRecordFields     #-} {-# LANGUAGE ExistentialQuantification #-}
src/HNormalise/Common/Json.hs view
@@ -1,3 +1,37 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric      #-} {-# LANGUAGE OverloadedStrings  #-}
src/HNormalise/Common/Parser.hs view
@@ -1,3 +1,37 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+ {-# LANGUAGE DeriveDataTypeable    #-} {-# LANGUAGE DeriveGeneric         #-} {-# LANGUAGE DuplicateRecordFields #-}
src/HNormalise/Config.hs view
@@ -1,10 +1,51 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+{-# LANGUAGE DuplicateRecordFields      #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE OverloadedStrings          #-} {-# LANGUAGE TemplateHaskell            #-}  module HNormalise.Config     ( Config(..)-    , PortConfig(..)+    , ConnectionType(..)+    , InputConfig(..)+    , OutputConfig(..)+    , TcpOutputConfig(..)+    , TcpPortConfig(..)+    , ZeroMQOutputConfig(..)+    , ZeroMQPortConfig(..)+    , connectionType     , loadConfig     ) where @@ -18,56 +59,145 @@ import qualified Data.Yaml        as Y import           System.Directory +import           Debug.Trace+--------------------------------------------------------------------------------+data ConnectionType = TCP+                    | ZeroMQ+                    deriving (Eq, Ord, Show) +connectionType :: Config -> ConnectionType+connectionType c =+    case input c >>= \(InputConfig t z) -> t of+        Just _ -> TCP+        _      -> ZeroMQ+ ---------------------------------------------------------------------------------data PortConfig = PortConfig-    { listenPort  :: !(Maybe Int)    -- ^ port for incoming messages-    , listenHost  :: !(Maybe Text)   -- ^ binding to this host specification (TODO: needs support for HostPreference)-    , successPort :: !(Maybe Int)    -- ^ port to send rsyslog with successfully parsed and normalised msg part-    , successHost :: !(Maybe Text)   -- ^ host to send normalised data to-    , failPort    :: !(Maybe Int)    -- ^ port to send rsyslog messges that failed to parse-    , failHost    :: !(Maybe Text)   -- ^ host to send original data to when parsing failed+data TcpPortConfig = TcpPortConfig+    { host   :: !(Maybe Text)+    , port   :: !(Maybe Int)     } deriving (Show)  ---------------------------------------------------------------------------------instance Monoid PortConfig where-    mempty = PortConfig-                Nothing Nothing Nothing Nothing Nothing Nothing-    mappend l r = PortConfig-        { listenPort  = listenPort  l `mplus` listenPort  r-        , listenHost  = listenHost  l `mplus` listenHost  r-        , successPort = successPort l `mplus` successPort r-        , successHost = successHost l `mplus` successHost r-        , failPort    = failPort    l `mplus` failPort    r-        , failHost    = failHost    l `mplus` failHost    r+instance Monoid TcpPortConfig where+    mempty = TcpPortConfig Nothing Nothing+    mappend (TcpPortConfig hl pl) (TcpPortConfig hr pr) = TcpPortConfig+        { host = hl `mplus` hr+        , port = pl `mplus` pr         }  ---------------------------------------------------------------------------------defaultPortConfig = PortConfig-    { listenPort = Just 4019-    , listenHost = Just "localhost"-    , successPort = Just 26002-    , successHost = Just "localhost"-    , failPort = Just 4018-    , failHost = Just "localhost"+data TcpOutputConfig = TcpOutputConfig+    { success :: !(Maybe TcpPortConfig)+    , failure :: !(Maybe TcpPortConfig)+    } deriving Show++--------------------------------------------------------------------------------+instance Monoid TcpOutputConfig where+    mempty = TcpOutputConfig Nothing Nothing+    mappend (TcpOutputConfig sl fl) (TcpOutputConfig sr fr) = TcpOutputConfig+        { success = sl `mplus` sr+        , failure = fl `mplus` fr+        }++--------------------------------------------------------------------------------+data ZeroMQPortConfig = ZeroMQPortConfig+    { method :: !(Maybe Text)+    , host   :: !(Maybe Text)+    , port   :: !(Maybe Int)+    } deriving (Show)++--------------------------------------------------------------------------------+instance Monoid ZeroMQPortConfig where+    mempty = ZeroMQPortConfig Nothing Nothing Nothing+    mappend (ZeroMQPortConfig ml hl pl) (ZeroMQPortConfig mr hr pr) = ZeroMQPortConfig+        { method = ml `mplus` mr+        , host   = hl `mplus` hr+        , port   = pl `mplus` pr+        }++--------------------------------------------------------------------------------+data ZeroMQOutputConfig = ZeroMQOutputConfig+    { success  :: !(Maybe ZeroMQPortConfig)+    , failure  :: !(Maybe ZeroMQPortConfig)+    } deriving (Show)++--------------------------------------------------------------------------------+instance Monoid ZeroMQOutputConfig where+    mempty = ZeroMQOutputConfig Nothing Nothing+    mappend (ZeroMQOutputConfig sl fl) (ZeroMQOutputConfig sr fr) = ZeroMQOutputConfig+        { success = sl `mplus` sr+        , failure = fl `mplus` fr+        }++--------------------------------------------------------------------------------+data InputConfig = InputConfig+    { tcp     :: !(Maybe TcpPortConfig)+    , zeromq  :: !(Maybe ZeroMQPortConfig)+    } deriving (Show)++--------------------------------------------------------------------------------+instance Monoid InputConfig where+    mempty = InputConfig Nothing Nothing+    mappend (InputConfig tl zl) (InputConfig tr zr) = InputConfig+        { tcp    = tl `mplus` tr+        , zeromq = zl `mplus` zr+        }++--------------------------------------------------------------------------------+data OutputConfig = OutputConfig+    { tcp     :: !(Maybe TcpOutputConfig)+    , zeromq  :: !(Maybe ZeroMQOutputConfig)+    } deriving (Show)++--------------------------------------------------------------------------------+instance Monoid OutputConfig where+    mempty = OutputConfig Nothing Nothing+    mappend (OutputConfig tl zl) (OutputConfig tr zr) = OutputConfig+        { tcp    = tl `mplus` tr+        , zeromq = zl `mplus` zr+        }+++--------------------------------------------------------------------------------+defaultInputTcpConfig = TcpPortConfig+    { port = Just 4019+    , host = Just "localhost"     } +defaultOutputTcpConfig = TcpOutputConfig+    { success = Just $ TcpPortConfig { host = Just "localhost", port = Just 26001 }+    , failure = Just $ TcpPortConfig { host = Just "localhost", port = Just 26002 }+    }++defaultInputConfig = InputConfig+    { tcp = Just defaultInputTcpConfig+    , zeromq = Nothing+    }++defaultOutputConfig = OutputConfig+    { tcp = Just defaultOutputTcpConfig+    , zeromq = Nothing+    }+ -------------------------------------------------------------------------------- data Config = Config-    { ports :: !(Maybe PortConfig)+    { input  :: !(Maybe InputConfig)+    , output :: !(Maybe OutputConfig)     , fields :: !(Maybe [(Text, Text)])     } deriving (Show)  -------------------------------------------------------------------------------- instance Monoid Config where-    mempty = Config Nothing Nothing+    mempty = Config Nothing Nothing Nothing     mappend l r = Config-        { ports = ports l `mplus` ports r+        { input  = input l  `mplus` input r+        , output = output l `mplus` output r         , fields = fields l `mplus` fields r         }  defaultConfig = Config-    { ports = Just defaultPortConfig+    { input = Nothing+    , output = Nothing     , fields = Nothing     } @@ -81,9 +211,10 @@     exists <- doesFileExist fp     if exists then do         contents <- B.readFile fp+        trace "file read" $ return ()         case Y.decodeEither contents of             Left err     -> error $ "HNormalise.Config.readConfig: " ++ err-            Right config -> return (config :: Config)+            Right config -> trace ("got " ++ show config) $ return (config :: Config)     else         return mempty @@ -98,5 +229,10 @@     return $ userConfig <> systemConfig <> defaultConfig  ---------------------------------------------------------------------------------$(deriveJSON defaultOptions ''PortConfig)+$(deriveJSON defaultOptions ''TcpPortConfig)+$(deriveJSON defaultOptions ''TcpOutputConfig)+$(deriveJSON defaultOptions ''ZeroMQPortConfig)+$(deriveJSON defaultOptions ''ZeroMQOutputConfig)+$(deriveJSON defaultOptions ''InputConfig)+$(deriveJSON defaultOptions ''OutputConfig) $(deriveJSON defaultOptions ''Config)
src/HNormalise/Huppel/Internal.hs view
@@ -1,3 +1,37 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+ {-# LANGUAGE DeriveDataTypeable    #-} {-# LANGUAGE DeriveGeneric         #-} {-# LANGUAGE DuplicateRecordFields #-}
src/HNormalise/Huppel/Json.hs view
@@ -1,3 +1,37 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric      #-} {-# LANGUAGE OverloadedStrings  #-}
src/HNormalise/Huppel/Parser.hs view
@@ -1,3 +1,37 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+ {-# LANGUAGE DeriveDataTypeable    #-} {-# LANGUAGE DeriveGeneric         #-} {-# LANGUAGE DuplicateRecordFields #-}
src/HNormalise/Internal.hs view
@@ -1,3 +1,37 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+ {-# LANGUAGE DeriveGeneric             #-} {-# LANGUAGE DuplicateRecordFields     #-} {-# LANGUAGE OverloadedStrings         #-}
src/HNormalise/Json.hs view
@@ -1,3 +1,37 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric      #-} {-# LANGUAGE OverloadedStrings  #-}
src/HNormalise/Lmod/Internal.hs view
@@ -1,3 +1,37 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+ {-# LANGUAGE DeriveDataTypeable    #-} {-# LANGUAGE DeriveGeneric         #-} {-# LANGUAGE DuplicateRecordFields #-}
src/HNormalise/Lmod/Json.hs view
@@ -1,3 +1,37 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric      #-} {-# LANGUAGE OverloadedStrings  #-}
src/HNormalise/Lmod/Parser.hs view
@@ -1,3 +1,37 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+ {-# LANGUAGE DeriveDataTypeable    #-} {-# LANGUAGE DeriveGeneric         #-} {-# LANGUAGE DuplicateRecordFields #-}
src/HNormalise/Parser.hs view
@@ -1,3 +1,37 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+ {-# LANGUAGE DeriveGeneric             #-} {-# LANGUAGE DuplicateRecordFields     #-} {-# LANGUAGE ExistentialQuantification #-}
src/HNormalise/Shorewall/Internal.hs view
@@ -1,3 +1,37 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+ {-# LANGUAGE DeriveGeneric             #-} {-# LANGUAGE DuplicateRecordFields     #-} {-# LANGUAGE ExistentialQuantification #-}
src/HNormalise/Shorewall/Json.hs view
@@ -1,3 +1,37 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric      #-} {-# LANGUAGE OverloadedStrings  #-}
src/HNormalise/Shorewall/Parser.hs view
@@ -1,3 +1,37 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+ {-# LANGUAGE DeriveDataTypeable    #-} {-# LANGUAGE DeriveGeneric         #-} {-# LANGUAGE DuplicateRecordFields #-}
src/HNormalise/Snoopy/Internal.hs view
@@ -1,3 +1,37 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+ {-# LANGUAGE DeriveGeneric             #-} {-# LANGUAGE DuplicateRecordFields     #-} {-# LANGUAGE ExistentialQuantification #-}
src/HNormalise/Snoopy/Json.hs view
@@ -1,3 +1,37 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric      #-} {-# LANGUAGE OverloadedStrings  #-}
src/HNormalise/Snoopy/Parser.hs view
@@ -1,3 +1,37 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+ {-# LANGUAGE DeriveDataTypeable    #-} {-# LANGUAGE DeriveGeneric         #-} {-# LANGUAGE DuplicateRecordFields #-}
src/HNormalise/Torque/Internal.hs view
@@ -1,3 +1,37 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+ {-# LANGUAGE BangPatterns          #-} {-# LANGUAGE DeriveDataTypeable    #-} {-# LANGUAGE DeriveGeneric         #-}@@ -23,6 +57,11 @@     } deriving (Show, Eq, Generic)  --------------------------------------------------------------------------------+data TorqueJobNode = TSN TorqueJobShortNode+                   | TFN [TorqueJobFQNode]+                   deriving (Show, Eq, Generic)++-------------------------------------------------------------------------------- data TorqueExecHost = TorqueExecHost     { name      :: !Text     , cores     :: ![Int]@@ -42,10 +81,10 @@     , advres        :: !(Maybe Text)     , naccesspolicy :: !(Maybe Text)     , ncpus         :: !(Maybe Int)-    , neednodes     :: !(Either TorqueJobShortNode [TorqueJobFQNode])+    , neednodes     :: !TorqueJobNode     , nice          :: !(Maybe Int)     , nodeCount     :: !Int-    , nodes         :: !(Either TorqueJobShortNode [TorqueJobFQNode])+    , nodes         :: !TorqueJobNode     , select        :: !(Maybe Text)     , qos           :: !(Maybe Text)     , pmem          :: !(Maybe Integer)
src/HNormalise/Torque/Json.hs view
@@ -1,3 +1,37 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric      #-} {-# LANGUAGE OverloadedStrings  #-}@@ -7,6 +41,7 @@  -------------------------------------------------------------------------------- import           Data.Aeson+import           Data.Monoid                 ((<>))  -------------------------------------------------------------------------------- import           HNormalise.Torque.Internal@@ -24,6 +59,10 @@  instance ToJSON TorqueWalltime where     toEncoding (TorqueWalltime d h m s) = toEncoding $ (((d * 24 + h) * 60) + m) * 60 + s++instance ToJSON TorqueJobNode where+    toEncoding (TSN n) = toEncoding n+    toEncoding (TFN ns) = toEncoding ns  instance ToJSON TorqueResourceRequest where     toEncoding = genericToEncoding defaultOptions
src/HNormalise/Torque/Parser.hs view
@@ -1,3 +1,37 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+ {-# LANGUAGE DeriveDataTypeable    #-} {-# LANGUAGE DeriveGeneric         #-} {-# LANGUAGE DuplicateRecordFields #-}@@ -87,14 +121,14 @@  -------------------------------------------------------------------------------- -- | 'parseTorqueResourceNodeList' parses a list of FQDN nodes and their ppn or a nodecount and its ppn-parseTorqueResourceNodeList :: Parser (Either TorqueJobShortNode [TorqueJobFQNode])+parseTorqueResourceNodeList :: Parser TorqueJobNode parseTorqueResourceNodeList = do     c <- peekChar'     if Data.Char.isDigit c then do         number <- decimal         ppn <- maybeOption $ char ':' *> string "ppn=" *> decimal-        return $ Left $ TorqueJobShortNode { number = number, ppn = ppn }-    else Right <$> (flip sepBy (char '+') $ do+        return $ TSN $ TorqueJobShortNode { number = number, ppn = ppn }+    else TFN <$> (flip sepBy (char '+') $ do         fqdn <- Data.Attoparsec.Text.takeWhile (/= ':')         ppn <- char ':' *> kvNumParser "ppn"         return TorqueJobFQNode { name = fqdn, ppn = ppn})
test/Bench.hs view
@@ -1,3 +1,37 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+ {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE OverloadedStrings     #-} 
test/HNormalise/Common/ParserSpec.hs view
@@ -1,3 +1,37 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+ {-# LANGUAGE OverloadedStrings     #-}  module HNormalise.Common.ParserSpec (main, spec) where
test/HNormalise/Lmod/ParserSpec.hs view
@@ -1,3 +1,37 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+ {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE OverloadedStrings     #-} 
test/HNormalise/ParserSpec.hs view
@@ -1,3 +1,37 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+ {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE OverloadedStrings     #-} @@ -30,7 +64,7 @@          it "imfile torque input" $ do             let s = "<133>1 2017-05-24T18:01:53.367275+02:00 test2802 torque - torque: 01/25/2017 15:04:10;E;0.master23.banette.gent.vsc;user=vsc40075 group=vsc40075 jobname=STDIN queue=short ctime=1485350399 qtime=1485350399 etime=1485350399 start=1485350407 owner=vsc40075@gligar03.gligar.gent.vsc exec_host=node2801.banette.gent.vsc/0 Resource_List.walltime=01:00:00 Resource_List.vmem=4224531456b Resource_List.nodect=1 Resource_List.nodes=1 Resource_List.neednodes=1 Resource_List.nice=0 session=22598 total_execution_slots=1 unique_node_count=1 end=1485353050 Exit_status=265 resources_used.cput=0 resources_used.energy_used=0 resources_used.mem=31032kb resources_used.vmem=1541612kb resources_used.walltime=00:44:04" :: Text-            s ~> (parseRsyslogLogstashString Nothing) `shouldParse` "{\"message\":\"torque: 01/25/2017 15:04:10;E;0.master23.banette.gent.vsc;user=vsc40075 group=vsc40075 jobname=STDIN queue=short ctime=1485350399 qtime=1485350399 etime=1485350399 start=1485350407 owner=vsc40075@gligar03.gligar.gent.vsc exec_host=node2801.banette.gent.vsc/0 Resource_List.walltime=01:00:00 Resource_List.vmem=4224531456b Resource_List.nodect=1 Resource_List.nodes=1 Resource_List.neednodes=1 Resource_List.nice=0 session=22598 total_execution_slots=1 unique_node_count=1 end=1485353050 Exit_status=265 resources_used.cput=0 resources_used.energy_used=0 resources_used.mem=31032kb resources_used.vmem=1541612kb resources_used.walltime=00:44:04\",\"syslog_abspri\":133,\"syslog_version\":1,\"program\":\"torque\",\"@source_host\":\"test2802\",\"torque\":{\"name\":{\"number\":0,\"array_id\":null,\"master\":\"master23\",\"cluster\":\"banette\"},\"user\":\"vsc40075\",\"group\":\"vsc40075\",\"jobname\":\"STDIN\",\"queue\":\"short\",\"startCount\":null,\"owner\":\"vsc40075@gligar03.gligar.gent.vsc\",\"session\":22598,\"times\":{\"ctime\":1485350399,\"qtime\":1485350399,\"etime\":1485350399,\"startTime\":1485350407,\"endTime\":1485353050},\"execHost\":[{\"name\":\"exec_host=node2801.banette.gent.vsc\",\"cores\":[0]}],\"resourceRequest\":{\"mem\":null,\"advres\":null,\"naccesspolicy\":null,\"ncpus\":null,\"neednodes\":{\"Left\":{\"number\":1,\"ppn\":null}},\"nice\":0,\"nodeCount\":1,\"nodes\":{\"Left\":{\"number\":1,\"ppn\":null}},\"select\":null,\"qos\":null,\"pmem\":null,\"vmem\":4224531456,\"pvmem\":null,\"walltime\":3600},\"resourceUsage\":{\"cputime\":0,\"energy\":0,\"mem\":31776768,\"vmem\":1578610688,\"walltime\":2644},\"totalExecutionSlots\":1,\"uniqueNodeCount\":1,\"exitStatus\":265}}"+            s ~> (parseRsyslogLogstashString Nothing) `shouldParse` "{\"message\":\"torque: 01/25/2017 15:04:10;E;0.master23.banette.gent.vsc;user=vsc40075 group=vsc40075 jobname=STDIN queue=short ctime=1485350399 qtime=1485350399 etime=1485350399 start=1485350407 owner=vsc40075@gligar03.gligar.gent.vsc exec_host=node2801.banette.gent.vsc/0 Resource_List.walltime=01:00:00 Resource_List.vmem=4224531456b Resource_List.nodect=1 Resource_List.nodes=1 Resource_List.neednodes=1 Resource_List.nice=0 session=22598 total_execution_slots=1 unique_node_count=1 end=1485353050 Exit_status=265 resources_used.cput=0 resources_used.energy_used=0 resources_used.mem=31032kb resources_used.vmem=1541612kb resources_used.walltime=00:44:04\",\"syslog_abspri\":133,\"syslog_version\":1,\"program\":\"torque\",\"@source_host\":\"test2802\",\"torque\":{\"name\":{\"number\":0,\"array_id\":null,\"master\":\"master23\",\"cluster\":\"banette\"},\"user\":\"vsc40075\",\"group\":\"vsc40075\",\"jobname\":\"STDIN\",\"queue\":\"short\",\"startCount\":null,\"owner\":\"vsc40075@gligar03.gligar.gent.vsc\",\"session\":22598,\"times\":{\"ctime\":1485350399,\"qtime\":1485350399,\"etime\":1485350399,\"startTime\":1485350407,\"endTime\":1485353050},\"execHost\":[{\"name\":\"exec_host=node2801.banette.gent.vsc\",\"cores\":[0]}],\"resourceRequest\":{\"mem\":null,\"advres\":null,\"naccesspolicy\":null,\"ncpus\":null,\"neednodes\":{\"number\":1,\"ppn\":null},\"nice\":0,\"nodeCount\":1,\"nodes\":{\"number\":1,\"ppn\":null},\"select\":null,\"qos\":null,\"pmem\":null,\"vmem\":4224531456,\"pvmem\":null,\"walltime\":3600},\"resourceUsage\":{\"cputime\":0,\"energy\":0,\"mem\":31776768,\"vmem\":1578610688,\"walltime\":2644},\"totalExecutionSlots\":1,\"uniqueNodeCount\":1,\"exitStatus\":265}}"          it "snoopy with process ID" $ do             let s = "<86>1 2017-05-29T16:40:48.275334+02:00 master23 snoopy[28949]: - snoopy[28949]::  [uid:992 username:nrpe sid:11542 tty:(none) cwd:/ filename:/usr/bin/which]: which python" :: Text
test/HNormalise/Shorewall/ParserSpec.hs view
@@ -1,3 +1,37 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+ {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE OverloadedStrings     #-} 
test/HNormalise/Snoopy/ParserSpec.hs view
@@ -1,3 +1,37 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+ {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE OverloadedStrings     #-} 
test/HNormalise/Torque/ParserSpec.hs view
@@ -1,3 +1,37 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+ {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE OverloadedStrings     #-} @@ -112,10 +146,10 @@                 , advres        = Nothing                 , naccesspolicy = Nothing                 , ncpus         = Nothing-                , neednodes     = Left TorqueJobShortNode { number = 1, ppn = Just 1 }+                , neednodes     = TSN $ TorqueJobShortNode { number = 1, ppn = Just 1 }                 , nice          = Nothing                 , nodeCount     = 1-                , nodes         = Left TorqueJobShortNode { number = 1, ppn = Just 1 }+                , nodes         = TSN $ TorqueJobShortNode { number = 1, ppn = Just 1 }                 , select        = Nothing                 , qos           = Nothing                 , pmem          = Nothing@@ -131,10 +165,10 @@                 , advres        = Nothing                 , naccesspolicy = Nothing                 , ncpus         = Nothing-                , neednodes     = Left TorqueJobShortNode { number = 1, ppn = Just 1 }+                , neednodes     = TSN $ TorqueJobShortNode { number = 1, ppn = Just 1 }                 , nice          = Nothing                 , nodeCount     = 1-                , nodes         = Left TorqueJobShortNode { number = 1, ppn = Just 1 }+                , nodes         = TSN $ TorqueJobShortNode { number = 1, ppn = Just 1 }                 , select        = Nothing                 , qos           = Nothing                 , pmem          = Nothing@@ -150,10 +184,10 @@                 , advres        = Nothing                 , naccesspolicy = Nothing                 , ncpus         = Nothing-                , neednodes     = Left TorqueJobShortNode { number = 1, ppn = Just 1 }+                , neednodes     = TSN $ TorqueJobShortNode { number = 1, ppn = Just 1 }                 , nice          = Nothing                 , nodeCount     = 1-                , nodes         = Left TorqueJobShortNode { number = 1, ppn = Just 1 }+                , nodes         = TSN $ TorqueJobShortNode { number = 1, ppn = Just 1 }                 , select        = Nothing                 , qos           = Nothing                 , pmem          = Just $ 200 * 1024@@ -169,10 +203,10 @@                 , advres        = Just "myreservation.1"                 , naccesspolicy = Nothing                 , ncpus         = Nothing-                , neednodes     = Left TorqueJobShortNode { number = 1, ppn = Just 1 }+                , neednodes     = TSN $ TorqueJobShortNode { number = 1, ppn = Just 1 }                 , nice          = Nothing                 , nodeCount     = 1-                , nodes         = Left TorqueJobShortNode { number = 1, ppn = Just 1 }+                , nodes         = TSN $ TorqueJobShortNode { number = 1, ppn = Just 1 }                 , select        = Nothing                 , qos           = Nothing                 , pmem          = Nothing@@ -188,10 +222,10 @@                 , advres        = Nothing                 , naccesspolicy = Nothing                 , ncpus         = Nothing-                , neednodes     = Left TorqueJobShortNode { number = 1, ppn = Just 1 }+                , neednodes     = TSN $ TorqueJobShortNode { number = 1, ppn = Just 1 }                 , nice          = Nothing                 , nodeCount     = 1-                , nodes         = Left TorqueJobShortNode { number = 1, ppn = Just 1 }+                , nodes         = TSN $ TorqueJobShortNode { number = 1, ppn = Just 1 }                 , select        = Nothing                 , qos           = Just "someqos"                 , pmem          = Nothing@@ -266,7 +300,7 @@                     , advres        = Nothing                     , naccesspolicy = Nothing                     , ncpus         = Nothing-                    , neednodes = Right+                    , neednodes = TFN                         [ TorqueJobFQNode                             { name = "node2801.banette.gent.vsc"                             , ppn  = 2@@ -278,7 +312,7 @@                         ]                     , nice      = Just 0                     , nodeCount = 2-                    , nodes = Right+                    , nodes = TFN                         [ TorqueJobFQNode                             { name = "node2801.banette.gent.vsc"                             , ppn  = 2
test/Spec.hs view
@@ -1,2 +1,36 @@+{- hnormalise - a log normalisation library+ -+ - Copyright Andy Georges (c) 2017+ -+ - All rights reserved.+ -+ - Redistribution and use in source and binary forms, with or without+ - modification, are permitted provided that the following conditions are met:+ -+ - * Redistributions of source code must retain the above copyright+ - notice, this list of conditions and the following disclaimer.+ -+ - * Redistributions in binary form must reproduce the above+ - copyright notice, this list of conditions and the following+ - disclaimer in the documentation and/or other materials provided+ - with the distribution.+ -+ - * Neither the name of Author name here nor the names of other+ - contributors may be used to endorse or promote products derived+ - from this software without specific prior written permission.+ -+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+-}+ -- file test/Spec.hs {-# OPTIONS_GHC -F -pgmF hspec-discover #-}