run bash script when ERROR spotted in logs in nxlog - nxlog

I am trying to run a script every time an error is found in logs
<Extension _exec>
Module xm_exec
</Extension>
<Input in>
Module im_file
File "/home/rafal/gitprojects/mst-sender/hub.cloudradar-error.log"
<Exec>
if $raw_event =~ /(\S+)\ (.+) \[ERROR (.+)/
{
exec_async("/bin/sh", "/home/rafal/gitprojects/mst-sender/run.sh");
}
</Exec>
</Input>
From their documentation it looks like it should exec async if regex matches but I am seeing only the following log
WARNING not starting unused module in
and the script is not executed.
I don't need to output it, only run that script.
[UPDATE]added route
<Output out1>
Module om_null
</Output>
<Route 1>
# Basic route
Path in => out1
</Route>

I don't need to output it, only run that script.
You need to.
What you can do is to create a route with om_null so that the output is discarded.

Related

How do I change the default location for mule application log files?

I would like to change the log directory from MULE_HOME/logs to MULE_HOME/logs/apps. The only place I have found that refers to a file path is in MULE_HOME/conf/wrapper.conf. Editing the wrapper.logfile does allow me to relocate the mule_ee.log file, which seems to be the Mule application log, but I'd like to include Mule application logs there, too. If I create an application called FOO and deploy it to the runtime environment, it will create a file called MULE_HOME/logs/mule-app-FOO.log, but changing the location seems to be difficult short of completely messing things up writing custom log4j2 XML files.
If you have Mule version 3.6+, then it is recommended to use log4j2.xml instead of log4j.xml.... Using log4j2 you can change the path and get your application log ... a simple example would be :-
<RollingFile name="RollingFile" fileName="${env:MULE_HOME}/logs/${sys:CustomapplicationName}.log"
filePattern="${env:MULE_HOME}/logs/${sys:CustomapplicationName}-%d{yyyy-MM-dd}-%i.log"> <!-- CustomapplicationName is set at mule-app.properties or in VM argument in Run As Configure as -DCustomapplicationName=Log4j -->
<PatternLayout>
<pattern>%d{dd/MMM/yyyy HH:mm:ss,SSS}- %c{1}: %m%n</pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="120 KB" />
</Policies>
<DefaultRolloverStrategy max="1" />
</RollingFile>
Just put this above code in your log4j2.xml in src/main/resource folder
Here in above you can see that, you have configured your path of your log files by mentioning here:-
<RollingFile name="RollingFile" fileName="${env:MULE_HOME}/logs/apps/${sys:CustomapplicationName}.log"
filePattern="${env:MULE_HOME}/logs/apps/${sys:CustomapplicationName}-%d{yyyy-MM-dd}-%i.log">
where ${sys:CustomapplicationName} is the System variable set in mule-app.properties as following :-
CustomapplicationName=yourApplicationName
Right way is to have log4j properties / xml file for FOO application and have that define the desired path for FOO application log. This way will ensure mule_ee.log is not messed up and at the same time other applications too will have their own log files which will be easy to manage and easy to introspect specific application log in case of errors / exceptions
Define location in log4j.properties file.

How can I change the value of $ProjectFileDir$ in IntelliJ IDEA 13?

I've added an item to my Tools menu using the XML below that runs custom actions for my project.
<?xml version="1.0" encoding="UTF-8"?>
<toolSet name="My Project Utilities">
<tool name="test" showInMainMenu="true" showInEditor="true" showInProject="true" showInSearchPopup="true" disabled="false" useConsole="true" showConsoleOnStdOut="false" showConsoleOnStdErr="false" synchronizeAfterRun="false">
<exec>
<option name="COMMAND" value="C:\path\to\ant.bat" />
<option name="PARAMETERS" value="my_task -Dmodule.dir=$ProjectFileDir$\my.module" />
<option name="WORKING_DIRECTORY" value="$ProjectFileDir$/my.working.dir/foo" />
</exec>
</tool>
</toolSet>
When I try to run this task, I get this error:
Error running test:
Cannot start process, the working directory C:\projects\something\my.working.dir\foo does not exist
The problem is $ProjectFileDir$ points to the wrong directory, C:\projects\something, and I need it to point to C:\projects. Is there a way to change the value of $ProjectFileDir without modifying the value of WORKING_DIRECTORY in my XML?
we did the samething but with a batch file . uploading the batch file and adding the project path at working directory .
Go to File >> Settings >> External Tools >> Add (+) Create Tool , you can follow the image. Hope this helps.

Activemq-camel: can not use <to uri="http://...">

I want help to solve this problem, the following code is in bean.xml gives me error
<camelContext id="activeContext1" xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="activemq:queue:ThermalMap"/>
<to uri="http://myhost:8161/Example?throwExceptionOnFailure=false"/>
</route>
</camelContext>
Error I get:
org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> To[http://myhost:8161/Example?throwExceptionOnFailure=false] <<< in route: Route[[From[activemq:queue:ThermalMap]] -> [To[htt://myhost... because of Failed to resolve endpoint: htt://myhost:8161/Example?throwExceptionOnFailure=false due to: Cannot auto create component: http
How can I solve this problem?
EDIT: I edit my application in eclipse. I have manually added all jar files in webcontent/WEB-INF/lib folder. Bean.xml is the one define my application. I used java to write my consumer() and processor() functions.
Perhaps you have not placed camel-http component in classpath. If you are using maven then put the dependency of camel-http component in your pom and it shall work.

DNN module package doesn't install controls

I am creating a DNN module, and have a working module based on this: http://www.subodh.com/Projects/DNN-Module.
When I install it on a DNN 5.6.2 installation, everything works fine, except the .ascx files do not copy over. If I copy the .ascx files manually, the module works fine.
My .dnn file looks like this:
...
<moduleDefinitions>
<moduleDefinition>
<friendlyName>SignUp.Control1</friendlyName>
<defaultCacheTime>0</defaultCacheTime>
<moduleControls>
<moduleControl>
<controlKey />
<controlSrc>Control1.ascx/Control1.ascx</controlSrc>
<supportsPartialRendering>True</supportsPartialRendering>
<controlTitle>Control1</controlTitle>
<controlType>View</controlType>
<iconFile />
<helpUrl />
<viewOrder>0</viewOrder>
</moduleControl>
...
</moduleControls>
</moduleDefinition>
</moduleDefinitions>
...
Specifically, Control1.ascx does not get copied to the DesktopModules/SignUp directory.
I do not get an error. Here is the relevant section of what DNN says when installing the module. I get no errors on install.
...
Info Component installed successfully - Script
Info Starting Installation - Module
Info Module registered successfully - SignUp
Info Component installed successfully - Module
Info Starting Installation - Assembly
...
Can anyone tell me why the controls are not copying over to the appropriate directory?
Thanks.
It seems you have a mistake in <controlSrc> tag, maybe you mean: <controlSrc>DesktopModules/SignUp.Control1/Control1.ascx</controlSrc>
Also you need to mention this file in <component type="File">:
<component type="File">
<files>
<file>
<path>Your Desire Path</path>
<name>Control1.ascx</name>
</file>
</files>
</component>
In addition to Ehsan's answer you can use MSBuild and Chris Hammonds template (http://christoctemplate.codeplex.com) which will create a resources zip and you have a single resources node rather than individual nodes for each file

ASP.NET Project Build Script For SVN and Cruise Control

I have a project in ASP.NET MVC 3, the solution file contains 28 projects in total. This all is in a directory which is configured with tortoise SVN to always get the latest updates from SVN.
I have also installed curisecontrol on my VPS box, where these whole solution exist. I have also created a website in my IIS and everything is in order now.
Can anyone guide me into some tutorials for the following:
How to setup curise control web dashboard, so my clients can have look on the builds and its reports
How to use MSBuild with Cruise Control in some step by step tuts
Any sample build script with following features
Email notification on build fail or successful build
stop the deployment if build is not successfull and create a build report
Thanks in advance
How to use MSBuild with Cruise Control in some step by step tuts
http://www.codeproject.com/Articles/12985/Practical-NET2-and-C-2-An-introduction-to-MSBuild
By default, the web dashboard of ccnet displays the result of build without exact error messages. To display the error in web dashboard, go to “C:\Program Files\CruiseControl.NET\webdashboard” and open file “dashboard.config”.
There, you will find the below code:
Collapse | Copy Code
xsl\header.xsl
xsl\modifications.xsl
xsl\unittests.xsl
xsl\MsTestSummary.xsl
xsl\fxcop-summary.xsl
xsl\NCoverSummary.xsl
xsl\SimianSummary.xsl
xsl\fitnesse.xsl
Now add this line in the above code:
Collapse | Copy Code
xsl\compile-msbuild.xsl
Therefore the code will become:
<buildReportBuildPlugin>
<xslFileNames>
<xslFile>xsl\header.xsl</xslFile>
<xslFile>xsl\modifications.xsl</xslFile>
<xslFile>xsl\compile-msbuild.xsl</xslFile>
<xslFile>xsl\unittests.xsl</xslFile>
<xslFile>xsl\MsTestSummary.xsl</xslFile>
<xslFile>xsl\fxcop-summary.xsl</xslFile>
<xslFile>xsl\NCoverSummary.xsl</xslFile>
<xslFile>xsl\SimianSummary.xsl</xslFile>
<xslFile>xsl\fitnesse.xsl</xslFile>
</xslFileNames>
</buildReportBuildPlugin>
We can also send the email to the user groups if the build fails.
<workingDirectory>D:\Projects\TheWorks\Applications\ProjectFolder</workingDirectory>
<buildArgs>ProjectName.msbuild /p:Configuration=Debug</buildArgs>
<timeout>1800</timeout>
<!-- 30 minutes -->
<logger>C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MSBuild.dll
</logger>
</msbuild>
</tasks>
<publishers>
<statistics />
<xmllogger />
<email from="EMAIL ADDRESS" mailhost="HOSTNAME"
mailhostPassword="PASSWORD" mailhostUsername="USERNAME"
includeDetails="true">
<users>
<user name="Jitendra Zaa"
address=ilovenagpur#gmail.com
group="AdminGroup" />
<user name="Santosh Karemore"
address=santosh.karemore#gmail.com
group="AdminGroup" />
<user name="Manoranjan sahoo"
address=manoranjan.sahoo#gmail.com
group="AdminGroup" />
<user name="Minal Shirsikar"
address="admin#shivasoft.in" group="Emul" />
</users>
<groups>
<group name="Emul" notification="failed" />
<group name="AdminGroup"
notification="failed" />
</groups>
</email>
</publishers>
</project>
The tags are self explanatory.
There may be following types of notification:
Failed
Fixed
Always
How to setup curise control web dashboard, so my clients can have look on the builds and its reports
-> you have to set a pwd in dashboard config file first and in web page, after set pwd you will be able to add plugin to make report like build report project report unit test report nant report check this url http://www.codeproject.com/Articles/70955/Set-up-the-Web-Dashboard-of-CCNet-to-Display-the-C
in ccnet documentation you will see all samples and step:
http://confluence.public.thoughtworks.org/display/CCNET/Documentation