Tuesday, October 13, 2015

Accessing files via HTTP Server

Accessing files via HTTP Server
I wanted to find out better way to monitor process server logs (JVM logs) from windows environment; the Document Monitor plugin for Notepad++ utility sounded like good option, though it works the delay between refresh is unacceptable and sometimes updates are not happening until you re-open the same file.
When I'm thinking about possible alternatives, IHS came in my mind; I've seen and set up IHS to expose UNIX directories accessible via web browser. So, I just tried to replicate the same at Windows environment and it worked like a charm

Assumption: IBM HTTP Server is installed and configured for SSL
What all required?
Obviously you need to know the list of log directories/location need to be made accessible via web browser
Here I wanted to expose to Deployment Manager Logs, Node logs which includes logs for process server deployment environment
Dmgr log location
C:\IBM\WebSphere\AppServer\profiles\DmgrProfile\logs
Node log location
C:\IBM\WebSphere\AppServer\profiles\Node1Profile\logs


Things to do at windows
  1. Create a new folder 'weblogs'
  2. Create new empty file with name '.htaccess' and save it under weblogs folder created in previous step
Note: little bit trick involved in creating file with dot '.' as prefix;
When you're about to save empty file in notepad make sure that you select save as type as 'All Files (*.*) as shown below


  1. Edit the '.htaccess' file and include the following lines
AuthName "Dmgr and Node logs"
AuthType Basic
AuthUserFile " C:\IBM\HTTPServer\conf\httpusers.htpasswd"
Require valid-user


What we've included above is the authentication information required to access the logs in a secure manner
httpusers.htpasswd – is the file which hold user account and password to access the logs
  1. Create symbolic link to log directories of dmgr and node profile and save it under web logs
mklink is the command used to create Symbolic links in windows
Command syntax


mklink           /D    <link location>     <target location>
mklink    /D  C:\IBM\WebSphere\weblogs\dmgrlogs    C:\IBM\WebSphere\AppServer\profiles\DmgrProfile\logs
mklink   /D   C:\IBM\WebSphere\weblogs\nodelogs    C:\IBM\WebSphere\AppServer\profiles\Node1Profile\logs


  1. Navigate to bin directory of IHS installation and create user repository as shown below
htpasswd    -c   C:/IBM/HTTPServer/conf/httpusers.htpasswd    psadmin
Here
httpusers.htpasswd is file to hold username and password
psadmin is the user account authorized to access the logs
-c denotes new password file created for the first time
Note: Make sure you don't specify option when adding subsequent users


  1. Edit the httpd.conf file and add the following entries
Make sure the following module is uncommented out at 'httpd.conf' file
'LoadModule alias_module modules/mod_alias.so'
<IfModule alias_module>
       Alias /weblogs "C:\IBM\WebSphere\weblogs"
</IfModule>

<Directory "C:\IBM\WebSphere\weblogs">
       Options Indexes FollowSymLinks Includes ExecCGI
       AllowOverride AuthConfig
       Order allow,deny
       Allow from all
</Directory>
Here
/weblogs – is the alias will mention at the URL (https://youservername:securedportno/weblogs)
Restart the HTTP Server


  1. Access the JVM logs via browser
Enter the below URL at web browser
You will be prompted to enter user account and password
Enter user name/password got created at step 5
Upon successful authentication dmgr logs and node logs visisble in the browser
Following dmgr logs further you can see the JVM logs
When you want to add any other directory, just create symbolic link at weblogs directory

1 comment: