http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-appender/src/test/java/org/apache/ambari/logsearch/appender/AppTest.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-appender/src/test/java/org/apache/ambari/logsearch/appender/AppTest.java b/ambari-logsearch/ambari-logsearch-appender/src/test/java/org/apache/ambari/logsearch/appender/AppTest.java new file mode 100644 index 0000000..8152787 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-appender/src/test/java/org/apache/ambari/logsearch/appender/AppTest.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.ambari.logsearch.appender; + +import org.apache.log4j.Logger; + +public class AppTest { + private static Logger logger = Logger.getLogger(AppTest.class); + + public static void main(String[] args) { + + try { + throwException(); + } catch (ClassCastException castException) { + logger.error("error", castException); + } + + } + + public static void throwException() { + throw new ClassCastException("test"); + + } +}
http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-appender/src/test/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-appender/src/test/resources/log4j.properties b/ambari-logsearch/ambari-logsearch-appender/src/test/resources/log4j.properties new file mode 100644 index 0000000..b51e87d --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-appender/src/test/resources/log4j.properties @@ -0,0 +1,23 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# log4j configuration used during build and unit tests + +# Root logger option +log4j.rootLogger=ALL, logsearchJson + +# Redirect log messages to a logsearch json +log4j.appender.logsearchJson=org.apache.ambari.logsearch.appender.LogsearchAppender +log4j.appender.logsearchJson.File=target/logsearch/log.json +log4j.appender.logsearchJson.datePattern='.'yyyy-MM-dd +log4j.appender.allLog.Append=true +log4j.appender.logsearchJson.layout=org.apache.ambari.logsearch.appender.LogsearchConversion \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-assembly/pom.xml ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-assembly/pom.xml b/ambari-logsearch/ambari-logsearch-assembly/pom.xml new file mode 100644 index 0000000..2db0608 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-assembly/pom.xml @@ -0,0 +1,510 @@ +<?xml version="1.0"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>ambari-logsearch</artifactId> + <groupId>org.apache.ambari</groupId> + <version>2.0.0.0-SNAPSHOT</version> + </parent> + <name>Ambari Logsearch Assembly</name> + <url>http://maven.apache.org</url> + <modelVersion>4.0.0</modelVersion> + <properties> + <mapping.base.path>/usr/lib</mapping.base.path> + <solr.tar>http://apache.mirrors.lucidnetworks.net/lucene/solr/${solr.version}/solr-${solr.version}.tgz</solr.tar> + <solr.mapping.path>${mapping.base.path}/ambari-logsearch-solr</solr.mapping.path> + <solr.package.name>ambari-logsearch-solr</solr.package.name> + <logsearch.portal.package.name>ambari-logsearch-portal</logsearch.portal.package.name> + <logsearch.portal.mapping.path>${mapping.base.path}/ambari-logsearch-portal</logsearch.portal.mapping.path> + <logsearch.portal.dir>${project.basedir}/../ambari-logsearch-portal</logsearch.portal.dir> + <logsearch.logfeeder.package.name>ambari-logsearch-logfeeder</logsearch.logfeeder.package.name> + <logsearch.logfeeder.mapping.path>${mapping.base.path}/ambari-logsearch-logfeeder</logsearch.logfeeder.mapping.path> + <logsearch.logfeeder.dir>${project.basedir}/../ambari-logsearch-logfeeder</logsearch.logfeeder.dir> + <logsearch.appender.package.name>ambari-logsearch-appender</logsearch.appender.package.name> + <logsearch.appender.mapping.path>${mapping.base.path}/ambari-logsearch-appender</logsearch.appender.mapping.path> + <logsearch.appender.dir>${project.basedir}/../ambari-logsearch-appender</logsearch.appender.dir> + <logsearch.portal.conf.mapping.path>/etc/${logsearch.portal.package.name}/conf</logsearch.portal.conf.mapping.path> + <logsearch.logfeeder.conf.mapping.path>/etc/${logsearch.logfeeder.package.name}/conf + </logsearch.logfeeder.conf.mapping.path> + </properties> + <artifactId>ambari-logsearch-assembly</artifactId> + <profiles> + + <profile> + <id>rpm</id> + <properties> + <download.solr>true</download.solr> + </properties> + <activation> + <property> + <name>build-rpm</name> + </property> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>rpm-maven-plugin</artifactId> + <version>2.1.4</version> + <configuration> + <copyright>2012, Apache Software Foundation</copyright> + <group>Development</group> + <description>Maven Recipe: RPM Package.</description> + <autoRequires>false</autoRequires> + <prefix>/</prefix> + <needarch>x86_64</needarch> + + <version>${package-version}</version> + <release>${package-release}</release> + + <defaultUsername>root</defaultUsername> + <defaultGroupname>root</defaultGroupname> + </configuration> + <executions> + <execution> + <id>logsearch-solr</id> + <phase>package</phase> + <goals> + <goal>rpm</goal> + </goals> + <configuration> + <group>Development</group> + <name>${solr.package.name}</name> + <mappings> + <mapping> + <directory>${solr.mapping.path}</directory> + <sources> + <source> + <location>${project.build.directory}/solr</location> + </source> + </sources> + </mapping> + </mappings> + </configuration> + </execution> + <execution> + <id>logsearch-portal</id> + <phase>package</phase> + <goals> + <goal>rpm</goal> + </goals> + <configuration> + <group>Development</group> + <name>${logsearch.portal.package.name}</name> + <mappings> + <mapping> + <directory>${logsearch.portal.mapping.path}</directory> + <sources> + <source> + <location>${logsearch.portal.dir}/target/package</location> + <excludes> + <exclude>classes/log4j.xml</exclude> + <exclude>classes/logsearch.properties</exclude> + <exclude>classes/user_pass.json</exclude> + <exclude>solr_configsets/**</exclude> + </excludes> + </source> + </sources> + </mapping> + <mapping> + <directory>${logsearch.portal.conf.mapping.path}</directory> + <sources> + <source> + <location>${logsearch.portal.dir}/target/package/classes</location> + <includes> + <include>log4j.xml</include> + <include>logsearch.properties</include> + <include>user_pass.json</include> + </includes> + </source> + </sources> + </mapping> + <mapping> + <directory>${logsearch.portal.conf.mapping.path}/solr_configsets</directory> + <sources> + <source> + <location>${logsearch.portal.dir}/target/package/solr_configsets</location> + </source> + </sources> + </mapping> + </mappings> + </configuration> + </execution> + <execution> + <id>logsearch-logfeeder</id> + <phase>package</phase> + <goals> + <goal>rpm</goal> + </goals> + <configuration> + <group>Development</group> + <name>${logsearch.logfeeder.package.name}</name> + <mappings> + <mapping> + <directory>${logsearch.logfeeder.mapping.path}</directory> + <sources> + <source> + <location>${logsearch.logfeeder.dir}/target/package</location> + <excludes> + <exclude>classes/log4j.xml</exclude> + <exclude>classes/logfeeder.properties</exclude> + <exclude>classes/grok-patterns</exclude> + </excludes> + </source> + </sources> + </mapping> + <mapping> + <directory>${logsearch.logfeeder.conf.mapping.path}</directory> + <sources> + <source> + <location>${logsearch.logfeeder.dir}/target/package/classes</location> + <includes> + <include>log4j.xml</include> + <include>logfeeder.properties</include> + <include>grok-patterns</include> + </includes> + </source> + </sources> + </mapping> + </mappings> + </configuration> + </execution> + <execution> + <id>logsearch-appender</id> + <phase>package</phase> + <goals> + <goal>rpm</goal> + </goals> + <configuration> + <group>Development</group> + <name>${logsearch.appender.package.name}</name> + <mappings> + <mapping> + <directory>${logsearch.appender.mapping.path}</directory> + <sources> + <source> + <location>${logsearch.appender.dir}/target/package</location> + </source> + </sources> + </mapping> + </mappings> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <version>1.7</version> + <executions> + <execution> + <phase>generate-resources</phase> + <goals> + <goal>run</goal> + </goals> + <configuration> + <target name="Download Solr"> + <get + src="${solr.tar}" + dest="${project.build.directory}/solr.tgz" + usetimestamp="true" + /> + <untar + src="${project.build.directory}/solr.tgz" + dest="${project.build.directory}/" + compression="gzip" + /> + <move todir="${project.build.directory}/solr"> + <fileset dir="${project.build.directory}/solr-${solr.version}"/> + </move> + <chmod file="${project.build.directory}/solr/bin/**" perm="755"/> + <chmod file="${project.build.directory}/solr/server/scripts/**" perm="755"/> + </target> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>deb</id> + + <activation> + <property> + <name>build-deb</name> + </property> + </activation> + + <build> + <plugins> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <version>2.7</version> + + <executions> + <execution> + <id>copy-resources</id> + <phase>package</phase> + <goals> + <goal>copy-resources</goal> + </goals> + <configuration> + <outputDirectory>${project.build.directory}/resources/deb</outputDirectory> + <resources> + <resource> + <directory>${project.basedir}/src/main/package/deb</directory> + <excludes> + <exclude>solr/postinst</exclude> + <exclude>portal/postinst</exclude> + <exclude>logfeeder/postinst</exclude> + <exclude>appender/postinst</exclude> + </excludes> + <filtering>false</filtering> + </resource> + <resource> + <directory>${project.basedir}/src/main/package/deb</directory> + <includes> + <include>solr/postinst</include> + <include>portal/postinst</include> + <include>logfeeder/postinst</include> + <include>appender/postinst</include> + </includes> + <filtering>true</filtering> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.vafer</groupId> + <artifactId>jdeb</artifactId> + <version>1.4</version> + <executions> + <execution> + <phase>package</phase> + <id>jdeb-solr</id> + <goals> + <goal>jdeb</goal> + </goals> + <configuration> + <controlDir>${basedir}/src/main/package/deb/solr</controlDir> + <deb>${basedir}/target/${solr.package.name}_${package-version}-${package-release}.deb</deb> + <skip>false</skip> + <skipPOMs>false</skipPOMs> + <dataSet> + <data> + <src>${project.build.directory}/solr</src> + <type>directory</type> + <mapper> + <type>perm</type> + <user>root</user> + <group>root</group> + <prefix>${solr.mapping.path}</prefix> + </mapper> + </data> + </dataSet> + </configuration> + </execution> + + <execution> + <id>jdeb-portal</id> + <phase>package</phase> + <goals> + <goal>jdeb</goal> + </goals> + <configuration> + <controlDir>${basedir}/src/main/package/deb/portal</controlDir> + <deb>${basedir}/target/${logsearch.portal.package.name}_${package-version}-${package-release}.deb + </deb> + <skip>false</skip> + <skipPOMs>false</skipPOMs> + <dataSet> + <data> + <src>${logsearch.portal.dir}/target/ambari-logsearch-portal.tar.gz</src> + <type>archive</type> + <mapper> + <prefix>${logsearch.portal.mapping.path}</prefix> + <type>perm</type> + <user>root</user> + <group>root</group> + </mapper> + <excludes> + classes/log4j.xml,classes/logsearch.properties,classes/user_pass.json,solr_configsets/** + </excludes> + </data> + <data> + <src>${logsearch.portal.dir}/target/package/classes</src> + <type>directory</type> + <mapper> + <prefix>${logsearch.portal.conf.mapping.path}</prefix> + <type>perm</type> + <user>root</user> + <group>root</group> + <filemode>644</filemode> + </mapper> + <includes> + log4j.xml,logsearch.properties,user_pass.json + </includes> + </data> + <data> + <src>${logsearch.portal.dir}/target/package/solr_configsets</src> + <type>directory</type> + <mapper> + <prefix>${logsearch.portal.conf.mapping.path}/solr_configsets</prefix> + <type>perm</type> + <user>root</user> + <group>root</group> + </mapper> + </data> + </dataSet> + </configuration> + </execution> + + <execution> + <id>jdeb-logfeeder</id> + <phase>package</phase> + <goals> + <goal>jdeb</goal> + </goals> + <configuration> + <controlDir>${basedir}/src/main/package/deb/logfeeder</controlDir> + <deb>${basedir}/target/${logsearch.logfeeder.package.name}_${package-version}-${package-release}.deb + </deb> + <skip>false</skip> + <skipPOMs>false</skipPOMs> + <dataSet> + <data> + <src>${logsearch.logfeeder.dir}/target/ambari-logsearch-logfeeder.tgz</src> + <type>archive</type> + <mapper> + <prefix>${logsearch.logfeeder.mapping.path}</prefix> + <type>perm</type> + <user>root</user> + <group>root</group> + </mapper> + <excludes> + classes/log4j.xml,classes/logfeeder.properties,classes/grok-patterns + </excludes> + </data> + <data> + <src>${logsearch.logfeeder.dir}/target/package/classes</src> + <type>directory</type> + <mapper> + <prefix>${logsearch.logfeeder.conf.mapping.path}</prefix> + <type>perm</type> + <user>root</user> + <group>root</group> + <filemode>644</filemode> + </mapper> + <includes> + log4j.xml,logfeeder.properties,grok-patterns + </includes> + </data> + </dataSet> + </configuration> + </execution> + + <execution> + <id>jdeb-appender</id> + <phase>package</phase> + <goals> + <goal>jdeb</goal> + </goals> + <configuration> + <controlDir>${basedir}/src/main/package/deb/appender</controlDir> + <deb>${basedir}/target/${logsearch.appender.package.name}_${package-version}-${package-release}.deb + </deb> + <skip>false</skip> + <skipPOMs>false</skipPOMs> + <dataSet> + <data> + <src>${logsearch.appender.dir}/target/ambari-logsearch-appender.tar.gz</src> + <type>archive</type> + <mapper> + <prefix>${logsearch.appender.mapping.path}</prefix> + <type>perm</type> + <user>root</user> + <group>root</group> + </mapper> + </data> + </dataSet> + </configuration> + </execution> + + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <version>1.7</version> + <executions> + <execution> + <phase>generate-resources</phase> + <goals> + <goal>run</goal> + </goals> + <configuration> + <target name="Download Solr"> + <get + src="${solr.tar}" + dest="${project.build.directory}/solr.tgz" + usetimestamp="true" + /> + <untar + src="${project.build.directory}/solr.tgz" + dest="${project.build.directory}/" + compression="gzip" + /> + <move todir="${project.build.directory}/solr"> + <fileset dir="${project.build.directory}/solr-${solr.version}"/> + </move> + <chmod file="${project.build.directory}/solr/bin/**" perm="755"/> + <chmod file="${project.build.directory}/solr/server/scripts/**" perm="755"/> + </target> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> + + <dependencies> + <dependency> + <groupId>org.apache.ambari</groupId> + <artifactId>ambari-logsearch-portal</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.ambari</groupId> + <artifactId>ambari-logsearch-logfeeder</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.ambari</groupId> + <artifactId>ambari-logsearch-appender</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + +</project> http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/appender/control ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/appender/control b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/appender/control new file mode 100644 index 0000000..9d07541 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/appender/control @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License +Package: [[logsearch.logfeeder.package.name]] +Version: [[package-version]]-[[package-release]] +Section: [[deb.section]] +Priority: [[deb.priority]] +Architecture: [[deb.architecture]] +Description: [[description]] +Maintainer: [[deb.publisher]] http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/appender/postinst ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/appender/postinst b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/appender/postinst new file mode 100644 index 0000000..21a01fa --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/appender/postinst @@ -0,0 +1,15 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/appender/postrm ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/appender/postrm b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/appender/postrm new file mode 100644 index 0000000..21a01fa --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/appender/postrm @@ -0,0 +1,15 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/appender/posttrm ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/appender/posttrm b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/appender/posttrm new file mode 100644 index 0000000..21a01fa --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/appender/posttrm @@ -0,0 +1,15 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/appender/preinst ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/appender/preinst b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/appender/preinst new file mode 100644 index 0000000..21a01fa --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/appender/preinst @@ -0,0 +1,15 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/appender/prerm ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/appender/prerm b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/appender/prerm new file mode 100644 index 0000000..21a01fa --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/appender/prerm @@ -0,0 +1,15 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/control ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/control b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/control new file mode 100644 index 0000000..9d07541 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/control @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License +Package: [[logsearch.logfeeder.package.name]] +Version: [[package-version]]-[[package-release]] +Section: [[deb.section]] +Priority: [[deb.priority]] +Architecture: [[deb.architecture]] +Description: [[description]] +Maintainer: [[deb.publisher]] http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/postinst ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/postinst b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/postinst new file mode 100644 index 0000000..21a01fa --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/postinst @@ -0,0 +1,15 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/postrm ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/postrm b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/postrm new file mode 100644 index 0000000..21a01fa --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/postrm @@ -0,0 +1,15 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/posttrm ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/posttrm b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/posttrm new file mode 100644 index 0000000..21a01fa --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/posttrm @@ -0,0 +1,15 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/preinst ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/preinst b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/preinst new file mode 100644 index 0000000..21a01fa --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/preinst @@ -0,0 +1,15 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/prerm ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/prerm b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/prerm new file mode 100644 index 0000000..21a01fa --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/prerm @@ -0,0 +1,15 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/control ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/control b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/control new file mode 100644 index 0000000..ed9cb59 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/control @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License +Package: [[logsearch.portal.package.name]] +Version: [[package-version]]-[[package-release]] +Section: [[deb.section]] +Priority: [[deb.priority]] +Depends: [[deb.dependency.list]] +Architecture: [[deb.architecture]] +Description: [[description]] +Maintainer: [[deb.publisher]] http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/postinst ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/postinst b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/postinst new file mode 100644 index 0000000..21a01fa --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/postinst @@ -0,0 +1,15 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/postrm ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/postrm b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/postrm new file mode 100644 index 0000000..21a01fa --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/postrm @@ -0,0 +1,15 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/preinst ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/preinst b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/preinst new file mode 100644 index 0000000..21a01fa --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/preinst @@ -0,0 +1,15 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/prerm ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/prerm b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/prerm new file mode 100644 index 0000000..21a01fa --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/prerm @@ -0,0 +1,15 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/solr/control ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/solr/control b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/solr/control new file mode 100644 index 0000000..5087cd0 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/solr/control @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License +Package: [[solr.package.name]] +Version: [[package-version]]-[[package-release]] +Section: [[deb.section]] +Priority: [[deb.priority]] +Depends: [[deb.dependency.list]] +Architecture: [[deb.architecture]] +Description: [[description]] +Maintainer: [[deb.publisher]] http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/solr/postinst ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/solr/postinst b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/solr/postinst new file mode 100644 index 0000000..21a01fa --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/solr/postinst @@ -0,0 +1,15 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/solr/postrm ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/solr/postrm b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/solr/postrm new file mode 100644 index 0000000..21a01fa --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/solr/postrm @@ -0,0 +1,15 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/solr/preinst ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/solr/preinst b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/solr/preinst new file mode 100644 index 0000000..21a01fa --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/solr/preinst @@ -0,0 +1,15 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/solr/prerm ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/solr/prerm b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/solr/prerm new file mode 100644 index 0000000..21a01fa --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/solr/prerm @@ -0,0 +1,15 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-logfeeder/README.md ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/README.md b/ambari-logsearch/ambari-logsearch-logfeeder/README.md new file mode 100644 index 0000000..d00eb57 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-logfeeder/README.md @@ -0,0 +1,36 @@ +<!-- +{% comment %} +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to you under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +{% endcomment %} +--> + +#LogSearch - LogFeeder: + +Logfeeder is a tool that reads log, parses it and stores it in Apache Solr for analyising purpose. + +#Compilation +mvn clean compile package + +#Deploy +##Copy to remote +copy target/logsearch-logfeeder.tgz to host machine + +##Setup environment +```bash +mkdir /opt/logfeeder +cd /opt/logfeeder +tar xfz ~/logsearch-logfeeder.tar.gz +``` http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-logfeeder/build.properties ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/build.properties b/ambari-logsearch/ambari-logsearch-logfeeder/build.properties new file mode 100644 index 0000000..46979e5 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-logfeeder/build.properties @@ -0,0 +1,18 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +app.pkg.dir=${app.work.dir}/pkg + +app.dev.war.dir=${app.work.dir}/webapps/logsearch +app.war.name=logsearch.war + +app.target.dir=${builddir}/target/classes/webapps/app \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-logfeeder/build.xml ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/build.xml b/ambari-logsearch/ambari-logsearch-logfeeder/build.xml new file mode 100644 index 0000000..53f893e --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-logfeeder/build.xml @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<project basedir="." default="build" name="logfeeder"> + <property environment="env"/> + <property name="debuglevel" value="source,lines,vars"/> + <dirname property="builddir" file="build.xml"/> + <property name="target" value="1.7"/> + <property name="source" value="1.7"/> + <property file="local.properties"/> + <property file="build.properties"/> + <target name="init"> + </target> + <target name="build"/> + + <target name="package"> + <delete dir="target/package"/> + <copy todir="target/package/libs" includeEmptyDirs="no"> + <fileset dir="target/libs"/> + </copy> + <copy todir="target/package/" includeEmptyDirs="no"> + <fileset file="target/LogFeeder.jar"/> + </copy> + <copy todir="target/package/classes" includeEmptyDirs="no"> + <fileset dir="target/classes"/> + </copy> + <copy todir="target/package" includeEmptyDirs="no"> + <fileset file="config.json"/> + </copy> + <copy todir="target/package" includeEmptyDirs="no"> + <fileset file="grok-patterns"/> + <fileset file="src/main/scripts/run.sh"/> + </copy> + <chmod file="target/package/run.sh" perm="755"/> + <tar compression="gzip" destfile="target/ambari-logsearch-logfeeder.tgz"> + <tarfileset mode="755" dir="target/package"> + <include name="*.sh"/> + </tarfileset> + <tarfileset mode="664" dir="target/package"> + <exclude name="*.sh"/> + </tarfileset> + </tar> + </target> + <target description="Build all projects which reference this project. Useful to propagate changes." + name="build-refprojects"/> +</project> http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-logfeeder/pom.xml ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/pom.xml b/ambari-logsearch/ambari-logsearch-logfeeder/pom.xml new file mode 100644 index 0000000..a1443c9 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-logfeeder/pom.xml @@ -0,0 +1,201 @@ +<?xml version="1.0"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <parent> + <artifactId>ambari-logsearch</artifactId> + <groupId>org.apache.ambari</groupId> + <version>2.0.0.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>ambari-logsearch-logfeeder</artifactId> + <groupId>org.apache.ambari</groupId> + <version>2.0.0.0-SNAPSHOT</version> + <packaging>jar</packaging> + <name>Ambari Logsearch Log Feeder</name> + <url>http://maven.apache.org</url> + + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.11</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>1.2.17</version> + </dependency> + <dependency> + <groupId>io.thekraken</groupId> + <artifactId>grok</artifactId> + <version>0.1.1</version> + </dependency> + <dependency> + <groupId>org.apache.solr</groupId> + <artifactId>solr-solrj</artifactId> + <version>${solr.version}</version> + </dependency> + <dependency> + <groupId>org.codehaus.jackson</groupId> + <artifactId>jackson-core-asl</artifactId> + <version>1.9.13</version> + </dependency> + <dependency> + <groupId>org.codehaus.jackson</groupId> + <artifactId>jackson-mapper-asl</artifactId> + <version>1.9.13</version> + </dependency> + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + <version>1.1.1</version> + </dependency> + + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + <version>18.0</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>1.7.7</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>1.7.10</version> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-csv</artifactId> + <version>1.2</version> + </dependency> + <dependency> + <groupId>org.apache.kafka</groupId> + <artifactId>kafka-clients</artifactId> + <version>0.9.0.0</version> + </dependency> + <dependency> + <groupId>org.codehaus.jackson</groupId> + <artifactId>jackson-xc</artifactId> + <version>1.9.13</version> + </dependency> + + </dependencies> + <build> + <finalName>LogFeeder</finalName> + <pluginManagement> + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.0</version> + </plugin> + <plugin> + <artifactId>maven-dependency-plugin</artifactId> + <version>2.8</version> + </plugin> + </plugins> + </pluginManagement> + + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.3</version> + <configuration> + <source>1.7</source> + <target>1.7</target> + </configuration> + </plugin> + + <!-- Exec main class plugin --> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>1.2.1</version> + <executions> + <execution> + <goals> + <goal>java</goal> + </goals> + </execution> + </executions> + <configuration> + <mainClass>org.apache.ambari.logfeeder.LogFeeder</mainClass> + <!-- <arguments> <argument></argument> </arguments> --> + </configuration> + </plugin> + <!-- copy-dependencies --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <version>2.8</version> + <executions> + <execution> + <id>copy-dependencies</id> + <phase>package</phase> + + <goals> + <goal>copy-dependencies</goal> + + </goals> + <configuration> + <artifactItems>*</artifactItems> + <outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename> + <outputDirectory>${basedir}/target/libs</outputDirectory> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>false</overWriteSnapshots> + <overWriteIfNewer>true</overWriteIfNewer> + </configuration> + </execution> + </executions> + </plugin> + <!-- ant pacakge --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <version>1.7</version> + <executions> + <execution> + <phase>package</phase> + <configuration> + <target> + <ant antfile="build.xml"> + <target name="package"/> + </ant> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-logfeeder/run.sh ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/run.sh b/ambari-logsearch/ambari-logsearch-logfeeder/run.sh new file mode 100755 index 0000000..70947ec --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-logfeeder/run.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +echo "LOG FEEDER" +mvn clean compile +mvn exec:java http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/AliasUtil.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/AliasUtil.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/AliasUtil.java new file mode 100644 index 0000000..3836c76 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/AliasUtil.java @@ -0,0 +1,110 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.logfeeder; + +import java.io.File; +import java.util.HashMap; + +import org.apache.log4j.Logger; + +public class AliasUtil { + + private static Logger logger = Logger.getLogger(AliasUtil.class); + + private static AliasUtil instance = null; + + private static String aliasConfigJson = "alias_config.json"; + + private HashMap<String, Object> aliasMap = null; + + public static enum ALIAS_TYPE { + INPUT, FILTER, MAPPER, OUTPUT + } + + public static enum ALIAS_PARAM { + KLASS + } + + /** + * + */ + private AliasUtil() { + init(); + } + + /** + * @return + */ + public static AliasUtil getInstance() { + if (instance == null) { + synchronized (AliasUtil.class) { + if (instance == null) { + instance = new AliasUtil(); + } + } + } + return instance; + } + + /** + */ + private void init() { + File jsonFile = LogFeederUtil.getFileFromClasspath(aliasConfigJson); + if (jsonFile != null) { + this.aliasMap = LogFeederUtil.readJsonFromFile(jsonFile); + } + + } + + + /** + * @param key + * @param aliastype + * @return + */ + public String readAlias(String key, ALIAS_TYPE aliastype, ALIAS_PARAM aliasParam) { + String result = key;// key as a default value; + HashMap<String, String> aliasInfo = getAliasInfo(key, aliastype); + String value = aliasInfo.get(aliasParam.name().toLowerCase()); + if (value != null && !value.isEmpty()) { + result = value; + logger.debug("Alias found for key :" + key + ", param :" + aliasParam.name().toLowerCase() + ", value :" + + value + " aliastype:" + aliastype.name()); + } else { + logger.debug("Alias not found for key :" + key + ", param :" + aliasParam.name().toLowerCase()); + } + return result; + } + + @SuppressWarnings("unchecked") + public HashMap<String, String> getAliasInfo(String key, ALIAS_TYPE aliastype) { + HashMap<String, String> aliasInfo = null; + if (aliasMap != null) { + String typeKey = aliastype.name().toLowerCase(); + HashMap<String, Object> typeJson = (HashMap<String, Object>) aliasMap.get(typeKey); + if (typeJson != null) { + aliasInfo = (HashMap<String, String>) typeJson.get(key); + } + } + if (aliasInfo == null) { + aliasInfo = new HashMap<String, String>(); + } + return aliasInfo; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/ConfigBlock.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/ConfigBlock.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/ConfigBlock.java new file mode 100644 index 0000000..6b78e2a --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/ConfigBlock.java @@ -0,0 +1,262 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.ambari.logfeeder; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.StringUtils; +import org.apache.log4j.Logger; +import org.apache.log4j.Priority; + +public abstract class ConfigBlock { + static private Logger logger = Logger.getLogger(ConfigBlock.class); + + boolean drain = false; + + protected Map<String, Object> configs; + protected Map<String, String> contextFields = new HashMap<String, String>(); + public MetricCount statMetric = new MetricCount(); + + /** + * + */ + public ConfigBlock() { + super(); + } + + /** + * Used while logging. Keep it short and meaningful + * + * @return + */ + public abstract String getShortDescription(); + + /** + * Every implementor need to give name to the thread they create + * + * @return + */ + public String getNameForThread() { + return this.getClass().getSimpleName(); + } + + /** + * @param metricsList + */ + public void addMetricsContainers(List<MetricCount> metricsList) { + metricsList.add(statMetric); + } + + /** + * This method needs to be overwritten by deriving classes. + * + * @throws Exception + */ + public void init() throws Exception { + + } + + /** + * @param map + */ + public void loadConfig(Map<String, Object> map) { + configs = LogFeederUtil.cloneObject(map); + + // Extract fields from config block + Map<String, String> nvList = getNVList("add_fields"); + if (nvList != null) { + contextFields.putAll(nvList); + } + } + + public Map<String, Object> getConfigs() { + return configs; + } + + @SuppressWarnings("unchecked") + public boolean isEnabled() { + boolean isEnabled = getBooleanValue("is_enabled", true); + if (isEnabled) { + // Let's check for static conditions + Map<String, Object> conditions = (Map<String, Object>) configs + .get("conditions"); + boolean allow = true; + if (conditions != null && conditions.size() > 0) { + allow = false; + for (String conditionType : conditions.keySet()) { + if (conditionType.equalsIgnoreCase("fields")) { + Map<String, Object> fields = (Map<String, Object>) conditions + .get("fields"); + for (String fieldName : fields.keySet()) { + Object values = fields.get(fieldName); + if (values instanceof String) { + allow = isFieldConditionMatch(fieldName, + (String) values); + } else { + List<String> listValues = (List<String>) values; + for (String stringValue : listValues) { + allow = isFieldConditionMatch(fieldName, + stringValue); + if (allow) { + break; + } + } + } + if (allow) { + break; + } + } + } + if (allow) { + break; + } + } + isEnabled = allow; + } + } + return isEnabled; + } + + public boolean isFieldConditionMatch(String fieldName, String stringValue) { + boolean allow = false; + String fieldValue = (String) configs.get(fieldName); + if (fieldValue != null && fieldValue.equalsIgnoreCase(stringValue)) { + allow = true; + } else { + @SuppressWarnings("unchecked") + Map<String, Object> addFields = (Map<String, Object>) configs + .get("add_fields"); + if (addFields != null && addFields.get(fieldName) != null) { + String addFieldValue = (String) addFields.get(fieldName); + if (stringValue.equalsIgnoreCase(addFieldValue)) { + allow = true; + } + } + + } + return allow; + } + + /** + * @param string + * @return + */ + @SuppressWarnings("unchecked") + public Map<String, String> getNVList(String key) { + return (Map<String, String>) configs.get(key); + } + + public String getStringValue(String key) { + Object value = configs.get(key); + if (value != null && value.toString().equalsIgnoreCase("none")) { + value = null; + } + if (value != null) { + return value.toString(); + } + return null; + } + + public String getStringValue(String key, String defaultValue) { + Object value = configs.get(key); + if (value != null && value.toString().equalsIgnoreCase("none")) { + value = null; + } + + if (value != null) { + return value.toString(); + } + return defaultValue; + } + + public Object getConfigValue(String key) { + return configs.get(key); + } + + public boolean getBooleanValue(String key, boolean defaultValue) { + String strValue = getStringValue(key); + boolean retValue = defaultValue; + if (!StringUtils.isEmpty(strValue)) { + if (strValue.equalsIgnoreCase("true") + || strValue.equalsIgnoreCase("yes")) { + retValue = true; + } else { + retValue = false; + } + } + return retValue; + } + + public int getIntValue(String key, int defaultValue) { + String strValue = getStringValue(key); + int retValue = defaultValue; + if (!StringUtils.isEmpty(strValue)) { + try { + retValue = Integer.parseInt(strValue); + } catch (Throwable t) { + logger.error("Error parsing integer value. key=" + key + + ", value=" + strValue); + } + } + return retValue; + } + + public Map<String, String> getContextFields() { + return contextFields; + } + + public void incrementStat(int count) { + statMetric.count += count; + } + + public void logStatForMetric(MetricCount metric, String prefixStr) { + LogFeederUtil.logStatForMetric(metric, prefixStr, ", key=" + + getShortDescription()); + } + + synchronized public void logStat() { + logStatForMetric(statMetric, "Stat"); + } + + public boolean logConfgs(Priority level) { + if (level.toInt() == Priority.INFO_INT && !logger.isInfoEnabled()) { + return false; + } + if (level.toInt() == Priority.DEBUG_INT && !logger.isDebugEnabled()) { + return false; + } + logger.log(level, "Printing configuration Block=" + + getShortDescription()); + logger.log(level, "configs=" + configs); + logger.log(level, "contextFields=" + contextFields); + return true; + } + + public boolean isDrain() { + return drain; + } + + public void setDrain(boolean drain) { + this.drain = drain; + } + +}
