Skip to content

Commit

Permalink
nginx support flow layout files added
Browse files Browse the repository at this point in the history
Signed-off-by: Shashwat Jaiswal <[email protected]>
  • Loading branch information
shashwatj07 committed Aug 24, 2022
1 parent fc69638 commit 166b296
Show file tree
Hide file tree
Showing 4 changed files with 409 additions and 45 deletions.
181 changes: 181 additions & 0 deletions ade-assembly/src/main/conf/xml/FlowLayoutNginx.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
Copyright Contributors to the ADE Project.
SPDX-License-Identifier: GPL-3.0-or-later
**/
This file is part of Anomaly Detection Engine for Linux Logs (ADE).
ADE is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ADE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ADE. If not, see <http://www.gnu.org/licenses/>.
-->
<tns:Layout xmlns:tns="http://flow.impl.ade.openmainframe.org/factory" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="FlowLayoutNginx.xsd ">
<!-- In order to stay compatible with 1.8 behavior (the Summary Type stored in the DB Table),
databaseId must be 0 for tenMinutes, and all upload must be using tenMinutes -->
<tns:FramingFlow consecutive="true" duration="60000" name="oneMinuteTrain" databaseId="0">
<tns:FramerClass>ConsecutiveTimeFramer</tns:FramerClass>
<tns:FramerProperty Key="Permanent_Split_Factor" Value="1"/>
<tns:FramerProperty Key="Temporary_Split_Factor" Value="1"/>
</tns:FramingFlow>
<tns:FramingFlow consecutive="true" duration="600000" name="tenMinutesTrain" databaseId="0">
<tns:FramerClass>ConsecutiveTimeFramer</tns:FramerClass>
</tns:FramingFlow>
<tns:FramingFlow consecutive="true" duration="600000" name="tenMinutes" databaseId="0">
<tns:FramerClass>ContinuousTimeFramer</tns:FramerClass>
<tns:FramerProperty Key="Permanent_Split_Factor" Value="1"/>
<tns:FramerProperty Key="Temporary_Split_Factor" Value="5"/>
</tns:FramingFlow>
<tns:FramingFlow consecutive="true" duration="1200000" name="twentyMinutesTrain" databaseId="2">
<tns:FramerClass>ConsecutiveTimeFramer</tns:FramerClass>
</tns:FramingFlow>
<tns:FramingFlow consecutive="true" duration="1200000" name="twentyMinutes" databaseId="2">
<tns:FramerClass>ContinuousTimeFramer</tns:FramerClass>
<tns:FramerProperty Key="Permanent_Split_Factor" Value="2"/>
<tns:FramerProperty Key="Temporary_Split_Factor" Value="5"/>
</tns:FramingFlow>
<tns:FramingFlow consecutive="true" duration="1800000" name="thirtyMinutesTrain" databaseId="3">
<tns:FramerClass>ConsecutiveTimeFramer</tns:FramerClass>
</tns:FramingFlow>
<tns:FramingFlow consecutive="true" duration="1800000" name="thirtyMinutes" databaseId="3">
<tns:FramerClass>ContinuousTimeFramer</tns:FramerClass>
<tns:FramerProperty Key="Permanent_Split_Factor" Value="3"/>
<tns:FramerProperty Key="Temporary_Split_Factor" Value="5"/>
</tns:FramingFlow>
<tns:FramingFlow consecutive="true" duration="2400000" name="fortyMinutesTrain" databaseId="4">
<tns:FramerClass>ConsecutiveTimeFramer</tns:FramerClass>
</tns:FramingFlow>
<tns:FramingFlow consecutive="true" duration="2400000" name="fortyMinutes" databaseId="4">
<tns:FramerClass>ContinuousTimeFramer</tns:FramerClass>
<tns:FramerProperty Key="Permanent_Split_Factor" Value="4"/>
<tns:FramerProperty Key="Temporary_Split_Factor" Value="5"/>
</tns:FramingFlow>
<tns:FramingFlow consecutive="true" duration="3600000" name="oneHourTrain" databaseId="6">
<tns:FramerClass>ConsecutiveTimeFramer</tns:FramerClass>
</tns:FramingFlow>
<tns:FramingFlow consecutive="true" duration="3600000" name="oneHour" databaseId="6">
<tns:FramerClass>ContinuousTimeFramer</tns:FramerClass>
<tns:FramerProperty Key="Permanent_Split_Factor" Value="6"/>
<!--60 minutes will be split into 6 permanent XML output, which is 10 minutes per output-->
<tns:FramerProperty Key="Temporary_Split_Factor" Value="5"/>
<!--10 minutes will be split into 5 temporary XML output, which is 2 minutes per output-->
</tns:FramingFlow>
<tns:FramingFlow consecutive="true" duration="7200000" name="twoHoursTrain" databaseId="12">
<tns:FramerClass>ConsecutiveTimeFramer</tns:FramerClass>
</tns:FramingFlow>
<tns:FramingFlow consecutive="true" duration="7200000" name="twoHours" databaseId="12">
<tns:FramerClass>ContinuousTimeFramer</tns:FramerClass>
<tns:FramerProperty Key="Permanent_Split_Factor" Value="12"/>
<tns:FramerProperty Key="Temporary_Split_Factor" Value="5"/>
</tns:FramingFlow>
<tns:FramingFlow consecutive="true" duration="10800000" name="threeHoursTrain" databaseId="18">
<tns:FramerClass>ConsecutiveTimeFramer</tns:FramerClass>
</tns:FramingFlow>
<tns:FramingFlow consecutive="true" duration="10800000" name="threeHours" databaseId="18">
<tns:FramerClass>ContinuousTimeFramer</tns:FramerClass>
<tns:FramerProperty Key="Permanent_Split_Factor" Value="18"/>
<tns:FramerProperty Key="Temporary_Split_Factor" Value="5"/>
</tns:FramingFlow>
<!-- *************************************************************** -->
<!-- NGINX -->
<!-- *************************************************************** -->
<tns:AnalysisGroupFlow name="NGINX">
<tns:UploadFramingFlow>oneMinuteTrain</tns:UploadFramingFlow>
<tns:TrainingIntervalFactor>1</tns:TrainingIntervalFactor>
<tns:AnalysisFramingFlow>oneMinuteTrain</tns:AnalysisFramingFlow>
<tns:ScoringSchema id="NGINX61" ScoredEntity="message">
<tns:ScorerClass>CriticalWordCountReporter</tns:ScorerClass>
</tns:ScoringSchema>
<tns:ScoringSchema id="NGINX01" ScoredEntity="message">
<tns:ScorerClass>ClusteringContextScore</tns:ScorerClass>
<tns:ScorerProperty Key="numClustersSqrtNumMsgs" Value="true"/>
<tns:ScorerProperty Key="numClustersSqrtNumMsgsFactor" Value="3"/>
<tns:ScorerProperty Key="numRuns" Value="50"/>
<tns:ScorerProperty Key="clusterContextFraction" Value="0.3"/>
<tns:ScorerProperty Key="seed" Value="1"/>
<tns:ScorerProperty Key="maxTrials" Value="100000"/>
<tns:ScorerProperty Key="maxIdleTrials" Value="15000"/>
<tns:ScorerProperty Key="minAppearThresh" Value="3"/>
<tns:ScorerProperty Key="alpha" Value="0.1"/>
<tns:ScorerProperty Key="minAverageInformationRatio" Value="2"/>
<tns:ScorerProperty Key="allowEmptyClusters" Value="false"/>
<tns:ScorerProperty Key="useTimelineForMutualInformation" Value="true"/>
<tns:ScorerProperty Key="trace" Value="false"/>
</tns:ScoringSchema>
<tns:ScoringSchema id="NGINX02" ScoredEntity="message">
<tns:ScorerClass>FullBernoulliClusterAwareScore</tns:ScorerClass>
<tns:ScorerProperty Key="ClusteringScorer" Value="ClusteringContextScore"/>
<tns:ScorerProperty Key="FullProb" Value="true"/>
<tns:DependsOn>NGINX01</tns:DependsOn>
</tns:ScoringSchema>
<tns:ScoringSchema id="NGINX11" ScoredEntity="message">
<tns:ScorerClass>LastSeenLoggingScorerContinuous</tns:ScorerClass>
</tns:ScoringSchema>
<tns:ScoringSchema id="NGINX12" ScoredEntity="message">
<tns:ScorerClass>LastSeenScorer</tns:ScorerClass>
<tns:DependsOn>NGINX11</tns:DependsOn>
</tns:ScoringSchema>
<tns:ScoringSchema id="NGINX21" ScoredEntity="message">
<tns:ScorerClass>BestOfTwoScorer</tns:ScorerClass>
<tns:ScorerProperty Key="firstScoreString" Value="FullBernoulliClusterAwareScore.logProb"/>
<tns:ScorerProperty Key="secondScoreString" Value="LastSeenScorer.LogProbGivenLast"/>
<tns:DependsOn>NGINX02</tns:DependsOn>
<tns:DependsOn>NGINX12</tns:DependsOn>
</tns:ScoringSchema>
<tns:ScoringSchema id="NGINX31" ScoredEntity="message">
<tns:ScorerClass>SeverityScore</tns:ScorerClass>
</tns:ScoringSchema>
<tns:ScoringSchema id="NGINX41" ScoredEntity="message">
<tns:ScorerClass>LogNormalScore</tns:ScorerClass>
<tns:ScorerProperty Key="baseScorer" Value="ClusteringContextScore"/>
<tns:ScorerProperty Key="noPeneltyOnMean" Value="true"/>
</tns:ScoringSchema>
<tns:ScoringSchema id="NGINX51" ScoredEntity="message">
<tns:ScorerClass>AdeWeightedMessageAnomalyScorerLogNormal</tns:ScorerClass>
<tns:ScorerProperty Key="baseScorer" Value="ClusteringContextScore"/>
<tns:ScorerProperty Key="severityScorer" Value="SeverityScore"/>
<tns:ScorerProperty Key="rarityScorer" Value="BestOfTwoScorer"/>
<tns:ScorerProperty Key="countScorer" Value="LogNormalScore"/>
<tns:DependsOn>NGINX01</tns:DependsOn>
<tns:DependsOn>NGINX31</tns:DependsOn>
<tns:DependsOn>NGINX21</tns:DependsOn>
<tns:DependsOn>NGINX41</tns:DependsOn>
</tns:ScoringSchema>
<tns:ScoringSchema id="NGINX52" ScoredEntity="interval">
<tns:ScorerClass>AdeAnomalyIntervalScorer</tns:ScorerClass>
<tns:DependsOn>NGINX51</tns:DependsOn>
</tns:ScoringSchema>
<tns:Outputer id="NGINXx12">
<tns:OutputerClass>org.openmainframe.ade.ext.output.ExtendedAnalyzedIntervalDbStorer</tns:OutputerClass>
</tns:Outputer>
<tns:Outputer id="NGINXx24">
<tns:OutputerClass>org.openmainframe.ade.ext.output.ExtJaxbAnalyzedPeriodV2XmlStorer</tns:OutputerClass>
<tns:OutputerProperty Key="outputOnTheFly" Value="true"/>
<tns:OutputerProperty Key="createXSLDirectory" Value="true"/>
<tns:OutputerProperty Key="formatXMLOutput" Value="true"/>
</tns:Outputer>
<tns:Outputer id="NGINXx32">
<tns:OutputerClass>org.openmainframe.ade.ext.output.ExtAnalyzedIntervalV2FullXmlStorer</tns:OutputerClass>
<tns:OutputerProperty Key="createXSLDirectory" Value="true"/>
<tns:OutputerProperty Key="outputInGZipFormat" Value="false"/>
</tns:Outputer>
<tns:Outputer id="NGINXx35">
<tns:OutputerClass>org.openmainframe.ade.ext.output.ExtJaxbAnalyzedIntervalV2XmlStorer</tns:OutputerClass>
<tns:OutputerProperty Key="createXSLDirectory" Value="true"/>
<tns:OutputerProperty Key="formatXMLOutput" Value="true"/>
</tns:Outputer>
<tns:FinalAnomalyMessageScorer>NGINX51</tns:FinalAnomalyMessageScorer>
<tns:FinalAnomalyIntervalScorer>NGINX52</tns:FinalAnomalyIntervalScorer>
</tns:AnalysisGroupFlow>
</tns:Layout>
175 changes: 175 additions & 0 deletions ade-assembly/src/main/conf/xml/FlowLayoutNginx.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
Copyright Contributors to the ADE Project.
SPDX-License-Identifier: GPL-3.0-or-later
**/
This file is part of Anomaly Detection Engine for Linux Logs (ADE).
ADE is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ADE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ADE. If not, see <http://www.gnu.org/licenses/>.
-->
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://flow.impl.ade.openmainframe.org/factory"
xmlns:tns="http://flow.impl.ade.openmainframe.org/factory"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
jaxb:version="2.0"
elementFormDefault="qualified">

<element name="Layout" type="tns:LayoutType">
<key name="framingFlowKey">
<selector xpath="tns:FramingFlow"/>
<field xpath="@name" />
</key>
<keyref name="framingFlowRef1" refer="tns:framingFlowKey">
<selector xpath="tns:AnalysisGroupFlow" />
<field xpath="tns:AnalysisFramingFlow" />
</keyref>
<keyref name="framingFlowRef2" refer="tns:framingFlowKey">
<selector xpath="tns:AnalysisGroupFlow/tns:ScoringSchema" />
<field xpath="tns:TrainingFramingFlow" />
</keyref>
<keyref name="framingFlowRef3" refer="tns:framingFlowKey">
<selector xpath="tns:AnalysisGroupFlow/tns:Outputer" />
<field xpath="tns:TrainingFramingFlow" />
</keyref>

<key name="scorerKey">
<selector xpath="tns:AnalysisGroupFlow/tns:ScoringSchema"/>
<field xpath="@id" />
</key>
<keyref name="ScorerRef1" refer="tns:scorerKey">
<selector xpath="tns:AnalysisGroupFlow/tns:ScoringSchema/tns:LinkedScorer" />
<field xpath="tns:Scorer" />
</keyref>
<keyref name="ScorerRef2" refer="tns:scorerKey">
<selector xpath="tns:AnalysisGroupFlow/tns:ScoringSchema/tns:DependsOn" />
<field xpath="." />
</keyref>
<keyref name="ScorerRef3" refer="tns:scorerKey">
<selector xpath="tns:AnalysisGroupFlow" />
<field xpath="tns:FinalAnomalyIntervalScorer" />
</keyref>
<keyref name="ScorerRef4" refer="tns:scorerKey">
<selector xpath="tns:AnalysisGroupFlow" />
<field xpath="tns:FinalAnomalyMessageScorer" />
</keyref>
</element>

<complexType name="LayoutType">
<sequence>
<element name="FramingFlow"
type="tns:FramingFlowType" maxOccurs="unbounded" minOccurs="1"/>
<element name="AnalysisGroupFlow"
type="tns:AnalysisGroupFlowType" maxOccurs="unbounded" minOccurs="1"/>
</sequence>
</complexType>


<complexType name="PropertyType">
<sequence></sequence>
<attribute name="Key" type="string"></attribute>
<attribute name="Value" type="string"></attribute>
</complexType>

<complexType name="LinkType">
<sequence></sequence>
<attribute name="Key" type="string"></attribute>
<attribute name="Scorer" type="string">
</attribute>
</complexType>


<complexType name="FramingFlowType">
<sequence>
<element name="FramerClass" type="string" maxOccurs="1"
minOccurs="1">
</element>
<element name="FramerProperty" type="tns:PropertyType"
maxOccurs="unbounded" minOccurs="0">
</element>
</sequence>
<attribute name="name" type="string" use="required"></attribute>
<attribute name="databaseId" type="int" use="required"></attribute>
<attribute name="duration" type="long" use="required"></attribute>
<attribute name="consecutive" type="boolean" use="required"></attribute>
</complexType>


<simpleType name="ScoredEntityEnum">
<restriction base="string">
<enumeration value="message"></enumeration>
<enumeration value="interval"></enumeration>
</restriction>
</simpleType>


<complexType name="ScoringSchemaType">
<sequence>
<element name="ScorerClass" type="string" maxOccurs="1"
minOccurs="1">
</element>
<element name="ScorerProperty" type="tns:PropertyType"
maxOccurs="unbounded" minOccurs="0">
</element>
<element name="LinkedScorer" type="tns:LinkType"
maxOccurs="unbounded" minOccurs="0">
</element>
<element name="TrainingFramingFlow" type="string" minOccurs="0"/>
<element name="DependsOn" type="string"
maxOccurs="unbounded" minOccurs="0">
</element>
</sequence>

<attribute name="id" type="string" use="required"/>

<attribute name="ScoredEntity" use="required" type="tns:ScoredEntityEnum"></attribute>
</complexType>

<complexType name="AnalysisGroupFlowType">
<sequence>
<element name="UploadFramingFlow" type="string" maxOccurs="1" minOccurs="0"/>
<element name="TrainingIntervalFactor" type="int" maxOccurs="1" minOccurs="0"/>
<element name="AnalysisFramingFlow" type="string" maxOccurs="1" minOccurs="0"/>
<element name="ScoringSchema" type="tns:ScoringSchemaType"
maxOccurs="unbounded" minOccurs="1">
</element>
<element name="Outputer" type="tns:OutputerType"
maxOccurs="unbounded" minOccurs="0">
</element>
<element name="FinalAnomalyMessageScorer" type="string" maxOccurs="1" minOccurs="1"></element>
<element name="FinalAnomalyIntervalScorer" type="string" maxOccurs="1" minOccurs="0"></element>
</sequence>
<attribute name="name" type="string" use="required"></attribute>
</complexType>

<complexType name="OutputerType">
<sequence>
<element name="OutputerClass" type="string" maxOccurs="1"
minOccurs="1">
</element>
<element name="OutputerProperty" type="tns:PropertyType"
maxOccurs="unbounded" minOccurs="0">
</element>
<element name="LinkedScorer" type="tns:LinkType"
maxOccurs="unbounded" minOccurs="0">
</element>
<element name="TrainingFramingFlow" type="string"
maxOccurs="1" minOccurs="0"/>
</sequence>

<attribute name="id" type="string" use="required"/>

</complexType>



</schema>
Loading

0 comments on commit 166b296

Please sign in to comment.