Seeing Bad parsing rule for Jenkins Log parser plugin - jenkins

I am trying to use Log Parser Plugin with Jenkins. Following is my rule file which I have taken from the sample given on the link.
# match line starting with 'error', case-insensitive
error /(?i)^error/
# list of warnings here...
warning /[Ww]arning/
warning /WARNING/
# create a quick access link to lines in the report containing 'INFO'
info /INFO/
# each line containing 'BUILD' represents the start of a section for grouping errors and warnings found after the line.
# also creates a quick access link.
start /BUILD/
I still see following at the end of the Parsed Console Output page:
NOTE: Some bad parsing rules have been found:
Bad parsing rule: , Error:1
Bad parsing rule: , Error:1
Bad parsing rule: , Error:1
I did come across this, but dint help as I am not using space anywhere.
Can someone help me resolving this issue?

It appears you have extra white-space somewhere in the file that the plugin is interpreting as you attempting to define a rule. Maybe try running it with the empty lines removed. That plugin has given me quite a bit of trouble as well, it's not very well documented (as is the case with many Jenkins plugins).

I had tried no spaces in the pattern, but that did not work. Turns out that the Parsing Rules files does not support empty lines in it. Once I removed the empty lines, I did not get this "Bad parsing rule: , Error:1".
I think since the line is empty - it doesn't echo any rule after the first colon. Would have been nice it the line number was reported where the problem is.
I posted the same to this thread too - Log parsing rules in Jenkins
Hopefully, it helps out other folks who may be wondering what is causing this.

Related

Machine parseable error messages

(From https://groups.google.com/d/msg/bazel-discuss/cIBIP-Oyzzw/caesbhdEAAAJ)
What is the recommended way for rules to export information about failures such that downstream tools can include them in UIs.
Example use case:
I ran bazel test //my:target, and one of the actions for //my:target fails because there is an unknown variable "usrname" in my/target.foo at line 7 column 10. It would also like to report that "username" is a valid variable and this is a possible misspelling. And thus wants to suggest an addition of an "e" character.
One way I have thought to do this is to have a separate file that my action produces //my:target.errors that is in a separate output group and have it write machine parseable data there in addition to human readable data on stdout.
I can then find all of these files and parse the data in them in downstream tools.
Is there any prior work on this, or does everything just try to parse the human readable output?
I recommend running the error checkers as extra actions.
I don't think Bazel currently has hooks for custom error handlers like you describe. Please consider opening a feature request: https://github.com/bazelbuild/bazel/issues/new

Bisonc++ - Verbose reporting to return conflicting rules?

I have a massive problem with bisonc++'s compiler: The error messages are garbage. It's really hard for me to find the problem, when all it says is Line 63: 2 Reduce/Reduce conflict(s) (line 63 is the last line of the code). Is there a way, a switch or anything to make bisonc++ also return the rules that cause the conflict? Any verbose error reporting? Thank you!
According to the bisonc++ man pages, you can request a detailed output that gets written into a .output file with the -V switch.
--verbose (-V)
Writes a file containing verbose descriptions of the parser states and what is done for each type of look-ahead token in
that state. This file also describes all conflicts detected in the
grammar, both those resolved by operator precedence and those that
remain unresolved. It is not created by default, but if requested the
information is written on .output, where is the
grammar specification file passed to bisonc++

parsing custom log in Logstash

I want to ask your help in parsing my logs in custom format. I tried to use http://grokdebug.herokuapp.com/ for discover my log format, but unfortunately I didn't succeed. my log has the next format:
#AdressHost#TypeLogs|OrganizationName|user#mail.com|CallMethod|ExecutionTimeOnDB|ExecutionTimeOnAppServer|Date Time
for example:
#mac.frozm.com#CallInfo|Jonsens|jack.lellow#jonsens.com|GetTotalsInfo|19|3|2014-05-11 07:49:10
I try to use the following pattern:
#%{URIHOST}#CallInfo|Jonsens|%{USER:auth}#%{URIPROTO}|GetTotalsInfo|%{NUMBER:duration}|0|%{DATESTAMP} %{TIME}
but Logstash keeps throwing "_grokparsefailure"
Can you help me or might suggest another way for parsing log in the Logstash tool
This part:
GetTotalsInfo|19|3|
does not seem to match up with this part of your pattern:
GetTotalsInfo|%{NUMBER:duration}|0|
as you specify a 0 in the pattern where in your example you have a 3.
Here's a general piece of advice when building grok patterns. Do small pieces of the pattern at a time, and check to see if they work first before building up a larger pattern. You can use this to debug patterns that are giving you trouble, taking each individual piece and testing them.
For example, just start out with a pattern like this and check to see if it works:
"^#%{URIHOST}"
(the ^ is a regex anchor that guarantees there are no preceding characters)
Build up from there.
I hope this helped!

Tokenize .htaccess files

Bet you didn't see this coming? ;)
So, a project of mine requires that I specifically read and make sense out of .htaccess files.
Sadly, searching on Google only yields the infinite woes of people trying to get their own .htaccess to work (sorry, couldn't resist the comment).
Anyway, I'm a bit scared of trying to get this thing out of open-source projects that use it. See, in the past few weeks, I ended up wasting a lot of time trying to fix my issues with this strategy, only to find out that I did better to read RFCs & specs and build the thing my way.
So, if you know about a library, or any (hopefully clean!) code that does this, please do share. In the mean time, if you know about any articles about .htaccess file format, I'm sure they'll be very handy. Thanks.
NB: I'm pretty much multilingual and could make use of any codebase, even though the end code will be Delphi. I know I'm asking too much, but I'd love to see less of C++. Just think of my mental health before sharing C++ code. :)
Edit: Well, I think I'm just going to do this manually myself. The file structure seems to be:
directive arg1 arg2 argN
<begin directive section>
</end directive section>
# single line comment
.htaccess grammar is actually the exact same as the Apache configuration itself, and example parsers do exist for it.
If you're looking to write your own, you are mostly correct on the format. Remember, section tags can be nested and can have parameters (like <Location />)
English method of parsing:
For each line in the file:
Strip whitespace from beginning and end of line.
If the line starts with a '#':
Parse it as a comment (or skip it)
Else, If the line starts with a '<':
If the next character is a '/', the line is a closing tag:
Seek to the next '>' to get the tag name, and pop it from the tag stack.
Else, the line is an opening tag:
Seek to the next '>' for the tag name.
If the tag, trimmed, contains whitespace:
Split on the first whitespace. The right side is params, left is the tag.
(IfModule, Location, etc use this)
Push the tag name to the tag stack.
Else, the line is a directive:
Split the line on whitespace. This is the directive and params.
Just add quote handling and you're set.

How do I fix 'Setup project with custom action file not found' exception?

I am trying to create a setup project for a Windows Service. I've followed the directions at http://support.microsoft.com/kb/816169 to create the setup project with no trouble.
I want to be able to get a value during the installation in order to update the app.config with the user's desired settings. I added a Textboxes (A) dialog to retrieve the values. I set the Edit1Property property to "TIMETORUN", and in my Primary Output action's CustomActionData property I put in the following: /TimeToRun="[TIMETORUN]\". So far so good. Running the setup I can retrieve the TimeToRun value from the Context.Parameters collection without issue.
In order to locate the app.config I need to also pass in the value of the TARGETDIR Windows Installer Property to my custom action. This is where things begin to fall apart. In order to achieve this, the above CustomActionData must be altered like so: /TimeToRun="[TIMETORUN]\" /TargetDir="[TARGETDIR]\". Now when I run the setup I get the following error message:
Error 1001. Exception occurred while initializing the installation.
System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:\Windows\SysWOW64\Files' or one of its dependencies. The system cannot
find the file specified.
If you google this problem you will inevitably find people having tremendous success by simply adding the trailing slash to the /TargetDir="[TARGETDIR]\" portion of the CustomActionData. This unfortunately does not solve my issue.
I tried so many different variations of the CustomActionData string and none of them worked. I tried logging to a file from my overridden Install method to determine where the breakage was, but no log file is created because it's not even getting that far. As the error indicates, the failure is during the Initialization step.
I have a hunch that it could be one of the dependencies that the setup project is trying to load. Perhaps somehow something is being appended to the CustomActionData string and isn't playing well with the TARGETDIR value (which contains spaces, i.e. "C:\Program Files\My Company\Project Name"). Again, this is another hunch that I cannot seem to confirm due to my inability to debug the setup process.
One further thing to mention, and yes it's another hunch, could this be an issue with Setup Projects on 64-bit version of Windows? I'm running Windows 7 Professional.
I'll provide names of the dependencies in case it helps:
Microsoft .NET Framework
Microsoft.SqlServer.DtsMsg.dll
Microsoft.SqlServer.DTSPipelineWrap.dll
Microsoft.SqlServer.DTSRuntimeWrap.dll
Microsoft.SQLServer.ManagedDTS.dll
Microsoft.SqlServer.msxml6_interop.dll
Microsoft.SqlServer.PipelineHost.dll
Microsoft.SqlServer.SqlTDiagM.dll
As you may glean from the dependencies, the Windows Service is scheduling a call to a DTSX package.
Sorry for the long rant. Thanks for any help you can provide.
The answer is so maddeningly simple. If the last argument in the CustomActionData is going to contain spaces and thus you have to surround it with quotes and a trailing slash, you must also have a space following the trailing slash, like this:
/TimeToRun="[TIMETORUN]\" /TargetDir="[TARGETDIR]\ "
The solution and explanation can be found here.
Had a similar issue. In my case, it was odd because my installer had ran successfully once, then I uninstalled my app via Add/Remove Programs successfully, did some coding (did NOT touch my CustomActionData string), and rebuilt my project and setup project. It was when I re-ran my MSI that I got this error.
The coding I had done was to bring in more values of more parameters I had been specifying in my CustomActionData string. That syntax for getting the parameter values (i.e. string filepath = Context.Paramenters["filepath"]), which was in my Installer class, was actually fine, but as I found out, the syntax of the later parameters I was now trying to get from my CustomActionData string had not been correct, from the very beginning. I had failed to add a second quote around one of those parameters, so nothing else could be obtained.
I was using the "Textboxes (A)" and "Textboxes (B)" windows in the User Interface section. A has 1 box, EDITA1, where I get the path to a file, and B has 2 boxes, EDITB1 and EDITB2, for some database parameters. My CustomActionData string looked like this:
/filepath="[EDITA1]" /host="[EDITB1] /port="[EDITB2]"
It should have been:
/filepath="[EDITA1]" /host="[EDITB1]" /port="[EDITB2]"
(closing quote on [EDITB1])

Resources