Nginx Jenkins日志解析器插件-解析的控制台日志页未显示X-Frame拒绝的加载选项不允许帧错误阻塞响应

Nginx Jenkins日志解析器插件-解析的控制台日志页未显示X-Frame拒绝的加载选项不允许帧错误阻塞响应,nginx,jenkins,jenkins-plugins,logparser,jenkins-2,Nginx,Jenkins,Jenkins Plugins,Logparser,Jenkins 2,詹金斯版本:1.642.3或2.32.3 詹金斯机器Ubuntu 14.04 日志解析器插件:2.0 从我的Mac OS sierra机器浏览Jenkins 在Jenkins全局配置中,我创建了一个新条目(描述和文件路径(完整),其中文件包含以下内容) 我创建了一个测试作业,为了捕获所有这些情况(如上所列),在作业的生成后部分中,我通过选择相同的日志解析文件条目(列表框选择)启用了“控制台输出(生成日志)解析”。 我运行了构建,果然失败了 Build step 'Console output

詹金斯版本:1.642.32.32.3

詹金斯机器Ubuntu 14.04

日志解析器插件:2.0

从我的Mac OS sierra机器浏览Jenkins

在Jenkins全局配置中,我创建了一个新条目(描述和文件路径(完整),其中文件包含以下内容)

我创建了一个测试作业,为了捕获所有这些情况(如上所列),在作业的
生成后
部分中,我通过选择相同的日志解析文件条目(列表框选择)启用了“控制台输出(生成日志)解析”。 我运行了构建,果然失败了

Build step 'Console output (build log) parsing' changed build result to FAILURE
在工作的仪表盘上,我看到了这个。

单击解析的控制台输出(左侧栏),将我带到一个页面,但没有给我任何有意义的信息。

当我将鼠标悬停在上面的侧栏链接上时,它显示Jenkins正在寻找给定作业构建编号的URL(如上图的地址栏所示)

我在这里缺少什么来获取解析的控制台输出页面,其中包含所有错误、警告和信息仪表板,就像这个插件在这里声称提供的那样:

PS:

在我的$JENKINS_主页(在master上)的plugins文件夹下,我看到了“log parser.hpi”文件(最新的文件和SHA与我在本地Mac机器上下载时看到的匹配)。在Jenkins重新启动期间,我没有看到任何与此插件相关的错误日志

在Jenkins job的$Jenkins_HOME/jobs//builds/文件夹中,我看到了大小有效的log*.html文件(这些文件由该插件读取,当您单击“解析控制台输出”侧栏链接时显示信息)

浏览log_ref.html显示有效链接

jenkins@jenkins-master:/opt/data/jenkins/jobs/testing_log_parser_testing/builds/14$ ls -ltr
total 40
-rw-r--r-- 1 jenkins jenkins    6 Aug 21 13:47 changelog.xml
-rw-r--r-- 1 jenkins jenkins 3145 Aug 21 13:47 log_content.html
-rw-r--r-- 1 jenkins jenkins  945 Aug 21 13:47 logwarningLinks.html
-rw-r--r-- 1 jenkins jenkins 4022 Aug 21 13:47 log_ref.html
-rw-r--r-- 1 jenkins jenkins  267 Aug 21 13:47 loginfoLinks.html
-rw-r--r-- 1 jenkins jenkins  277 Aug 21 13:47 log.html
-rw-r--r-- 1 jenkins jenkins 1130 Aug 21 13:47 logerrorLinks.html
-rw-r--r-- 1 jenkins jenkins 2315 Aug 21 13:47 log
-rw-r--r-- 1 jenkins jenkins 1089 Aug 21 13:47 injectedEnvVars.txt
-rw-r--r-- 1 jenkins jenkins 2391 Aug 21 13:47 build.xml
jenkins@jenkins-master:/opt/data/jenkins/jobs/testing_log_parser_testing/builds/14$ cat -n loginfoLinks.html
     1  <li>1 <a target="content" href="log_content.html#INFO1"><span style="color:blue">rsync: failed to set times on/</span></a></li><br/>
     2  <li>2 <a target="content" href="log_content.html#INFO2"><span style="color:blue">svn: E170001: Auth reqd i guess</span></a></li><br/>
jenkins@jenkins-master:/opt/data/jenkins/jobs/testing_log_parser_testing/builds/14$ cat -n logwarningLinks.html
     1  HEADER HERE: #0
     2  <li>1 <a target="content" href="log_content.html#WARNING1"><span style="color:orange">WARNING: are not that bad actually</span></a></li><br/>
     3  <li>2 <a target="content" href="log_content.html#WARNING2"><span style="color:orange">npm WARN retry -- won't do any good</span></a></li><br/>
     4  <li>3 <a target="content" href="log_content.html#WARNING3"><span style="color:orange">svn: E200033: db locked again?? no way</span></a></li><br/>
     5  <li>4 <a target="content" href="log_content.html#WARNING4"><span style="color:orange">: binary operator expected -- lol</span></a></li><br/>
     6  <li>5 <a target="content" href="log_content.html#WARNING5"><span style="color:orange">: too many arguments - check the usage please</span></a></li><br/>
     7  <li>6 <a target="content" href="log_content.html#WARNING6"><span style="color:orange">: No such file or directory comes whenever you are looking for something which doesn't exist atm</span></a></li><br/>
jenkins@jenkins-master:/opt/data/jenkins/jobs/testing_log_parser_testing/builds/14$ cat log_ref.html 
<!DOCTYPE html>
<html>
        <head>
                <title>log-parser plugin page</title>
                <link type="text/css" rel="stylesheet" href="https://jenkins-master.company.com/jenkins_instance01/css/style.css" />
                <link type="text/css" rel="stylesheet" href="https://jenkins-master.company.com/jenkins_instance01/css/color.css" />
        </head>
        <body>
<script type="text/javascript">
        function toggleList(list){
                element = document.getElementById(list).style;
                element.display == 'none' ? element.display='block' : element.display='none';
        }
</script>
<img src="https://jenkins-master.company.com/jenkins_instance01///static/a8e7a2ad/images/16x16/red.gif" style="margin: 2px;" width="24" alt="Error Icon" height="24" />
<a href="javascript:toggleList('Error')" target="_self"><STRONG>Error (7)</STRONG></a><br />
<ul id="Error" style="display:none; margin-left:0; padding-left:3em">
 <a target="content" href="log_content.html">Beginning of log</a>
<br/>(7 Errors in this section)<br/>
<li>1 <a target="content" href="log_content.html#ERROR1"><span style="color:red">1 ERROR: Couldn't find any revision to build &lt;= this is an error</span></a></li><br/>
<li>2 <a target="content" href="log_content.html#ERROR2"><span style="color:red">SyntaxError: Use of const in strict mode &lt;= this is another type of error (syntax)</span></a></li><br/>
<li>3 <a target="content" href="log_content.html#ERROR3"><span style="color:red">svn: E220003: Unable to connect to a repository at URL</span></a></li><br/>
<li>4 <a target="content" href="log_content.html#ERROR4"><span style="color:red">svn: E220003: Invalid authz configuration</span></a></li><br/>
<li>5 <a target="content" href="log_content.html#ERROR6"><span style="color:red">npm ERR! fetch failed-- fetch may be?</span></a></li><br/>
<li>6 <a target="content" href="log_content.html#ERROR7"><span style="color:red">ERROR: svn up failed for --- well why not switch to Git/Hg</span></a></li><br/>
</ul>
<img src="https://jenkins-master.company.com/jenkins_instance01///static/a8e7a2ad/images/16x16/yellow.gif" style="margin: 2px;" width="24" alt="Warning Icon" height="24" />
<a href="javascript:toggleList('Warning')" target="_self"><STRONG>Warning (6)</STRONG></a><br />
<ul id="Warning" style="display:none; margin-left:0; padding-left:3em">
 <a target="content" href="log_content.html">Beginning of log</a>
<br/>(6 Warnings in this section)<br/>
<li>1 <a target="content" href="log_content.html#WARNING1"><span style="color:orange">WARNING: are not that bad actually</span></a></li><br/>
<li>2 <a target="content" href="log_content.html#WARNING2"><span style="color:orange">npm WARN retry -- won't do any good</span></a></li><br/>
<li>3 <a target="content" href="log_content.html#WARNING3"><span style="color:orange">svn: E200033: db locked again?? no way</span></a></li><br/>
<li>4 <a target="content" href="log_content.html#WARNING4"><span style="color:orange">: binary operator expected -- lol</span></a></li><br/>
<li>5 <a target="content" href="log_content.html#WARNING5"><span style="color:orange">: too many arguments - check the usage please</span></a></li><br/>
<li>6 <a target="content" href="log_content.html#WARNING6"><span style="color:orange">: No such file or directory comes whenever you are looking for something which doesn't exist atm</span></a></li><br/>
</ul>
<img src="https://jenkins-master.company.com/jenkins_instance01///static/a8e7a2ad/images/16x16/blue.gif" style="margin: 2px;" width="24" alt="Info Icon" height="24" />
<a href="javascript:toggleList('Info')" target="_self"><STRONG>Info (2)</STRONG></a><br />
<ul id="Info" style="display:none; margin-left:0; padding-left:3em">
<li>1 <a target="content" href="log_content.html#INFO1"><span style="color:blue">rsync: failed to set times on/</span></a></li><br/>
<li>2 <a target="content" href="log_content.html#INFO2"><span style="color:blue">svn: E170001: Auth reqd i guess</span></a></li><br/>
</ul>
        </body>
</html>
如果我浏览
https:////job///parsed_console/log.html
,然后在
Inspect page>Console
窗口中显示以下行:

https://<jenkins_server>/<jenkins_instance>/job/<job_name>/<build_number>/parsed_console/log_ref.html does not permit framing.  (unknown)
Load denied by X-Frame-Options: https://<jenkins_server>/<jenkins_instance>/job/<job_name>/<build_number>/parsed_console/log_content.html does not permit framing.  (unknown)

问题不在于插件

使用网页上的
Inspect
,很明显在Apache/Nginx中设置了拒绝

我修改了my
/etc/nginx/sites enabled/jenkins_https.conf
文件

   #add_header X-Frame-Options DENY;

插件现在正在按预期呈现输出

另一个更好的解决方案是:

替换以下行

#add_header X-Frame-Options DENY;
使用nginx配置文件中的以下行:

add_header X-Frame-Options SAMEORIGIN;
参考:
或者添加更多我发现的信息。
Refused to display 'https://<jenkins_server>/<jenkins_instance>/job/<jobname>/15/parsed_console/job/<jobname>/15/parsed_console/log.html' in a frame because it set 'X-Frame-Options' to 'deny'.
(index):22 GET https://<jenkins_server>/<jenkins_instance>/job/<jobname>/15/parsed_console/job/<jobname>/15/parsed_console/log.html net::ERR_BLOCKED_BY_RESPONSE
   #add_header X-Frame-Options DENY;
sudo service nginx restart
#add_header X-Frame-Options DENY;
add_header X-Frame-Options SAMEORIGIN;