Use Tomcat to access the file cross the environment

Source: Internet
Author: User

Background

A small tool in the project, is a cron job, every day to collect the server Hadoop job running state, and generate a report sent to the entire team, production reports at the same time the relevant log files saved to a fixed machine, easy to view and analyze later, Because the log on the production environment is only saved for 7 days.

Problem:

The log is saved on a fixed directory, and is on the Linux system, is our local machine. Our email report cannot be accessed through the file schema, so I want to build a Web server through Tomcat to access the file, which can cross the environment, and foreign colleagues can

See the log information.

Solve:

Tomcat version:7.0.55

Update the Server.xml

Autodeploy= "false" name= "localhost" unpackwars= "true"
Xmlnamespaceaware= "false" xmlvalidation= "false" >
<!--Singlesignon valve, share authentication between Web applications
Documentation at:/docs/config/valve.html--
<!--
<valve classname= "Org.apache.catalina.authenticator.SingleSignOn"/>
-

<!--Access log processes all example.
Documentation at:/docs/config/valve.html
Note:the pattern used is equivalent to using pattern= "common"-
<valve classname= "Org.apache.catalina.valves.AccessLogValve" directory= "Logs"
prefix= "Localhost_access_log" suffix= ". txt"
pattern= "%h%l%u%t &quot;%r&quot; %s%b "/>

<context docbase= "/home/hadoop/uc4report" path= "/project/report"/>
</Host>

-----------------------------------------------------------------------------------------------

/home/hadoop/uc4report is the file folder

/project/report is the access path

We can access the file md_run_influencer_prod_586404867:

http://10.**.**.52:8080/project/report/2014-08-04/md_run_influencer_prod_586404867

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.