Ventu
Ventu

Reputation: 800

Jenkins: Log parser Plugin Error: Cannot parse log: Can't read parsing rules file

i put my parsing rules file in:

/var/lib/jenkins/jobs/Wireshark/parsing_rules.txt

in the jenkins configuration, where i have to set the path to my parsing file, i set the same path. But the Plugin can not find the file. It is only returning this error:

log-parser plugin ERROR: Cannot parse log: Can't read parsing rules file: /var/lib/jenkins/jobs/Wireshark/parsing_rules.txt 

The content of the file is:

warn /| Failure/
ok /| Ok/

Can someone help me solving this error?

Upvotes: 1

Views: 3452

Answers (3)

Dmytro Molchanov
Dmytro Molchanov

Reputation: 151

I faced this problem too, @ablarg helped me partially by showing "directions" for solution, but I will expand answer for Jenkins beginners like me and those who were not given infrastructure road-map =)

First you need to know on which server and in which directory you have a master and nodes.

1. Go to Jenkins settings - Nodes https://your_jenkins_url/computer/

This will display all nodes and the master, find your job to understand on which server (IP) located workspace directory, and on which server (IP) is the JENKINS_HOME directory.

Now you need to check logs for node or master to understand on which server you can find job workspace directory or the directory for the global settings. https://your_jenkins_url/computer/your_node_name/log

You will see the IP address of the server:

Inbound agent connected from 192.168.1.1

2. Now you need to know the path of the directory JENKINS_HOME and WORKSPACE job. Go to: https://your_jenkins_url/systemInfo

And search for "JENKINS_HOME"

The default is:

/var/lib/jenkins

This is the directory where you need to put the log parser configuration file for the Global Setup.

To define the workspace directory of the job you can simply specify in the "Console output (build log)" - "Use project rule" the name of the config file and when you start the job the path will be displayed in "Console Output (parsed)".

For example:

java.nio.file.NoSuchFileException: /var/lib/jenkins/jobs/your_project_folder/jobs/your_node_name/jobs/your_job_name/workspace/your_file

Now when you know on which server the node is located, you can put the log configuration file to the path shown in "Console Output (parsed)" output.

P.S. Don't forget to set Chown of the user you have Jenkins running on this server for your log parser configuration file

Also you don't have to specify full path for "Use project rule", just file name. enter image description here

Upvotes: 1

backboner
backboner

Reputation: 21

I had the same problem, but under windows. After restarting Jenkins, it works.

Upvotes: 0

ablarg
ablarg

Reputation: 2490

TL:DR: Jenkins log parser files must be placed on the master, not slaves.

You are placing the parsing log rules file in the jobs folder: /var/lib/jenkins/jobs/Wireshark/parsing_rules.txt

Are you expecting Jenkins to find it on the slave? Jenkins looks for the file at the specifed path on the master not the slave, because the job's log parsing is performed on the master, not the slave.

You may define multiple parsers so you can have different parsers for different jobs.

You add each parser to the Configure System page, and in the job configuration, select the log parser you wish to parse your console log.

Upvotes: 2

Related Questions