Re: JSON Logging of Tomcat Access Log.

2016-05-29 Thread Rajesh Cherukuri
you can use grok to covert to JSON  that is  how i have done it

On Wed, May 25, 2016 at 9:03 PM, Abhijit Das  wrote:

> I am wanting to change the access logging format to JSON (for easier
> parsing with logstash)
>
> I currently have the following config in my server.xml … How would i
> change this to JSON formatted?
>
>className="org.apache.catalina.valves.RemoteIpValve"
> internalProxies="1\.1\.1\.1"
> trustedProxies="1\.1\.1\.1"
> remoteIpHeader="X-Forwarded-For"
> proxiesHeader="x-forwarded-by"
> requestAttributesEnabled="true"/>
>
>className="org.apache.catalina.valves.AccessLogValve"
> directory="logs"
> prefix="localhost_access_log"
> suffix=".txt"
> pattern="%t %h %{X-AUSERNAME}o %{Referer}i %l %S
> %{User-Agent}i %U %s %r %q %A %v %p %b %I %D"
> requestAttributesEnabled="true"
> resolveHosts="false"/>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: How to cancel download on the server side

2016-05-29 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Steffen,

On 5/29/16 2:08 PM, Steffen Heil (Mailinglisten) wrote:
> I am streaming a huge file from a servlet to the browser. It can
> easily be multiple gigabytes.
> 
> Currently the data is prepared on the server, stored in a file and
> then sent to the client with a "Content-Disposition: attachment"
> header, so the browser handles it as a download. After the transfer
> the file is immediately deleted.
> 
> This kind of works but has two big disadvantages: 1. The client has
> to wait a long time until the first byte is transferred. I am
> afraid I could run into browser (or generic client) timeouts. 2. I
> need a lot of storage on the server.
> 
> The data I have could easily be streamed directly to the client
> without storing it on the server at all. I would not know the
> precise size of the data In advance, but it could be transferred
> using "Transfer-Encoding: junked" so this would not be a problem.
> 
> My problem is that if anything goes wrong while creating the data I
> have no way to notify the client, as the response headers were
> already sent way before. So I am looking for a way to cancel the
> download from the server side and letting the client know that
> something went wrong. Simply stopping sending data is not enough,
> the client needs to know that the data is incomplete.
> 
> Probably the only way to do that would be to abruptly disconnect
> the http(s) connection without completing the download using a
> "0\r\n" end marker.
> 
> So my questions are: 1. How can I force tomcat to disconnect a
> client like that? 2. Does anyone here have tried anything like that
> before? What client side reactions did you notice?

I believe that, while the HTTP specification supports what you want to
do, neither servers nor clients support it. For example, you can use
"trailers" (headers end the end of the response) to tell the client
what happened, but I suspect that no client will actually read them or
act on them.

I don't think you really have an option, here, for transmitting a huge
file with graceful error-handling sometime in the middle of the
creation/transmission of the data.

You can always force a disconnect by simply closing the response
stream. Usually, the client will either tell the user that the
download failed (connection closed before response - or chunk of
response - completed), more likely just shows the user a blank page or
saves an incomplete file.

- -chris
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJXSzkyAAoJEBzwKT+lPKRYapoP/i9pIzvWTCVrfvUrYErQagyC
QIshcEX/Sqw3AlLLMiSuhSjykdn2pyRwu1XlwnVS+pRP0g0C5orj8QiQNGHJKg6m
dBCUe5rwBnGSvILFJMM7Nbq9i8mHyDhU3hWctjFbCXwL/i+q9pRZr66DkS9F1Hya
7QiDnqIvckZ3iYNn2JySWPVYTwDP718o17ypX+zmPOjRkYr66h/Xvtv8I5bpChgM
96zt9oGXPt8WDaWfrFMuZZlDsW2E+E6LVHQNEBWNepOuw5aLn6TgyWReWNysaeBY
NV5t1bzLEC1iYKquOqOZcsRBRHx7ArKtAv1RUYvsqSUpqiysgiWfYOYCFEyBCrET
mG9T/88GIiqW6+lZwdzxB6r2VPEgpbhQV0Ufwp55YWbHUPJPICYAVyA3lAlEGcG/
1ES9TduGcOF0CHYLAKYQ0dYBaGCGW1YjTHZ/C0bGMG7T4l7w0N/nQ6RrYuoMWsOt
CnE8FuqyVzHX1qT4FSCqyRSUYC7cNu8YccMpjmTcyjmC5KeZYbUTIMP3iAOVD0Dl
rZ2HOBdlMSwqJtnr6h3MUqF7mBqkKjhmt19mpEeXibsGpXCjULRNFXw7FIS3ZLyV
NK7EXJIfitldyF5nsIuXRQamPkBTht82zORBwYyjPrLgeEYLHYpOW3ewK8wvcBNB
f7r/Gh1KuHucNJwDrirw
=SqNN
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Direct url access to protected page: /docs*

2016-05-29 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Robert,

On 5/27/16 10:35 PM, Robert Youngblood wrote:
> Chris, thank you for your reply. Are you saying that you normally
> rename the catalina folder to catalina_base and then create empty
> catalina_home folder.

No. CATALINA_HOME and CATALINA_BASE refer to the environment variables
used to control a split-installation of Tomcat where the Tomcat base
files are in one location and your "active" installation (basically,
your server.xml and webapps) are in another. Read the "Advanced
Configuration - Multiple Tomcat Instances" section of the RUNNING.txt
for details.

> So, when i unc to server:8080, do i go to the catalina\webapps
> folder?

What you /what/ to port 8080?

The bottom line is that you need to remove the sample/demo
applications from any production-quality instance of Tomcat.

- -chris

> On 5/27/16 1:16 PM, Robert Youngblood wrote:
 I was recently cited for these pages not being locked down.
 Is there a way to remove or lockdown the default pages?
> 
> What default pages? Do you mean the "docs" web application?
> 
> $ rm -rf webapps/docs
> 
> You might want to remove the other stock applications as well...
> you should only be deploying those on a test/dev server.
> 
> I always recommend a split CATALINA_HOME/CATALINA_BASE where 
> CATALINA_HOME has a stock Tomcat deployment (including all of the 
> optional web applications in CATALINA_HOME/webapps) and then only
> my own web applications in CATALINA_BASE/webapps.
> 
> That way, you don't have to remember to remove the sample
> applications.
> 
> -chris
>> 
>> -
>>
>> 
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>> 
>> 
> 
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJXSzfeAAoJEBzwKT+lPKRYwysQAJSw0TrRlOCP/GWlZSTAYMI+
oKQkpXtLrdANluL1+BkYP2zppnQ22GWMl31y7RMqBxErY+B3fhI+fPPPpkvCSAUs
GHjckqeQKrySWsngoBQHRKd6JIrhhhblBNUd8aKrJ+4VfDMtGnACbpbd20K9TNse
kGOwXpIfqJ2s/N7rTl1ux4ngV63M0/HEX5N7pQlkqJlRBo95JnMamXfqVw6eHhUa
1RIZCrojEEpbbJYol1HwElsRGEgdvUsD4XaCZI1xCUKXRlg7hjl0PPnLNZ2ixKds
V4uh1yg4c0lUmLDLuFgcU8i+czVIjogxw+YkD/toxASerhr7UW61NunIOqZXnFl9
93QrO5Z/NiYuA9eG8IqcZUx00OlQeoMu14BQ8yYlF/wqcuguoXqO3zWP9fzukgdD
REWGeB78k3wAdjd+9ZjBvFAl2HV7uLOC9Z7AiiiD/dDE95tG4D+0Ya4vckPsYw+7
xZR1xNWHGYtLcsyAXwSNiCTJ5O5NsqL1EsqSyjTFxkcXCoUtYbVMvl/LsKs8ioGy
2Pg4uOciiqqyBSLFUkrTYVlD9aZGlgrA9Ya8VQjxd1G0LazGlnRP1rS5pqN49VFO
YiM2HbTriFpeGaBgTjbU2XzSRI+A/RKkGGadfQtUROod1ShMfGgf40peTbqEn+yW
L3pLOMAG0HP64iXBZvSk
=PH1y
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



How to cancel download on the server side

2016-05-29 Thread Steffen Heil (Mailinglisten)
Hi


I am streaming a huge file from a servlet to the browser.
It can easily be multiple gigabytes.

Currently the data is prepared on the server, stored in a file and then sent to 
the client with a "Content-Disposition: attachment" header, so the browser 
handles it as a download. After the transfer the file is immediately deleted.

This kind of works but has two big disadvantages:
1. The client has to wait a long time until the first byte is transferred. I am 
afraid I could run into browser (or generic client) timeouts.
2. I need a lot of storage on the server.

The data I have could easily be streamed directly to the client without storing 
it on the server at all.
I would not know the precise size of the data In advance, but it could be 
transferred using "Transfer-Encoding: junked" so this would not be a problem.

My problem is that if anything goes wrong while creating the data I have no way 
to notify the client, as the response headers were already sent way before.
So I am looking for a way to cancel the download from the server side and 
letting the client know that something went wrong.
Simply stopping sending data is not enough, the client needs to know that the 
data is incomplete. 

Probably the only way to do that would be to abruptly disconnect the http(s) 
connection without completing the download using a "0\r\n" end marker.

So my questions are:
1. How can I force tomcat to disconnect a client like that?
2. Does anyone here have tried anything like that before? What client side 
reactions did you notice?


Best regards,
  Steffen



smime.p7s
Description: S/MIME cryptographic signature