How to add a custom variable with apache logs? [closed] - apache

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
How to add custom variable name with apache logs so that I can add my project name with my error logs in beginning, it is helpful for recognizing error logs with project name. I have lot of projects in my organization and project can be build in any language, I want to track all logs on a one place, but issue is that which errors are coming from which projects, i am unable to get it, so I want to add project name with logs. please suggest me, if any documentation is there, so i can manipulate apache then share with me.

Apache Access Log is using a log format defined by LogFormat directive.
This format can contain a lot of things. One of theses things is %{VARNAME}e : The contents of the environment variable VARNAME. So using SetEnv on your application VirtualHosts you could manage your goals.
But this does not work for ErrorLog. If you manage applications with Virtualhosts you should use separate ErrorLog files on theses Virtualhosts.

Related

How can I prevent apache to log Health Checks in Docker? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I have a dockerized web application deployed, and everything works just fine, logging every request, including a HUGE number of health checks, which are configured to hit the page /health, a blank page.
I think it's a common problem, and I found this question for a different stack (Elastic Beanstalk).
I'd like to have a solution that is completely automatic and possibly in the Dockerfile
First of all, I need an additional configuration file for Apache, let's call it apacheLogFilter.conf.
The content will be pretty easy, but it could be customized as much as we want, defining custom rules. The trick is defining a custom environment variable that, if present, will stop the logging for that request
SetEnvIf Request_URI "^/health$" dontlog
Once defined this new configuration, we need to plug it into apache directly in the Dockerfile, adding the following rows:
FROM php:7.2-apache
...
# Copy the log-filtering configuration in the right place
COPY apacheLogFilter.conf /etc/apache2/conf-enabled
# Change the standard logging entry of all the available sites to use the variable
RUN sed -ri -e 's!combined!combined env=\!dontlog!g' /etc/apache2/sites-available/*.conf
...
In this way, the configuration file will be loaded by apache at startup, each request will check the rules defined, and in case one of them will trigger, the request will not be logged

Special configuration of the vhost [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I've got some headache trying to configure that for some days so I hope someone can help me.
I've got few sites, each one related to an FTP account. I would like to make them accessible through my man website by the url http://www.mainsite.com/site1. At this point an Alias should do the work.
However I would like to add some features such as specify the log file related to the site1 which would be in the web directory of the FTP account site1. Later, I would like to put them in /var/log and have a script to sync the log file located in the web directory with the one in /var/log so that even if a user delete the log file in the web directory, the original one is still here.
To go back to the main problem, I don't know how to do that, I tried to configure a whole vhost for the site1 but then, as the ServerName would be the same as the main site, the main site would no longer be accessible.
Any suggestions ?
You could try the ancient ServerPath directive, which will cause /site1 to be mapped to one vhost and /site2 to be mapped to another, despite having matching servername and local interface:port.

WinSCP Cannot overwrite. Permission issues [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
On my remote server A, I have a bunch of .py files.
I drag those files to a Windows machine, B, via WinSCP.
I work on these files on the Windows machine and want to import them back to server A via WinSCP.
When I try that, it says "cannot overwrite".
Obviously it's a permissions issue. I am not sure how much permission I need to give in order to have the overwrite access.
Currently, I have -r--r--r-- on these files for reading.
I am guessing I need write access? Or do I need execute access as well?
Will chmod 755 * be sufficient? I want to be careful with permissions so I am asking on here.
That depends on what users are owner of the files and the one you connect with SCP.
If they are the same, then '-rw-r--r--' should be enough.
If they are on the same group then -rw-rw-r--

Removal of the /var/www/icons alias from Apache config [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have a directory called /var/www/icons on my web server, which is also referenced as an alias in my Apache config as seen below:
Alias /icons/ "/var/www/icons/"
The directory contains a number of small PNGs and GIFs, which AFAIK are unused, along with a README file.
Am I safe to remove this alias from my Apache config by commenting it out? If not, what area of my application is the removal of this likely to effect?
There is very little documentation available on this directory and I must admit i've never came across it up until now.
Most icons are used for displaying file types in directory listings. If you do not use such listings, you can safely remove alias + files. I did so and do not miss them.
It is for sure safe to remove it. Other conf files could reference /icons (e. g. the autoindex module) but apart from some not found errors nothing nasty should happen.
My advice: scan the access.log files to see if urls rooted at /icons are accessed. Delete the alias and monitor the error.log file for 404 errors.

Is there an online LDAP emulator? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 months ago.
Improve this question
I'm doing some homework with LDAP that consists of creating LDIF files, adding them to the LDAP server, and afterwards performing some searches and viewing the results.
To avoid installing LDAP in my computer, I'm wondering if there exists some LDAP emulator online service where I can execute these instructions.
I've seen something similar with "online sql emulator", but not anything about LDAP.
Another alternative is the in-memory directory server provided by the UnboundID LDAP SDK, which I talk about here. There is no need to install a server. LdapListenerExample.java gives an example of how to use the in-memory directory server. The example shows how to create the server, start it listening, load schema files listed as command line options, and load a file containing LDIF into the server database.
Unfortunately, I'm not aware of such a thing.
As an alternative, I'd suggest you use OpenDS, which is very easy to deploy (e.g. via Install with QuickSetup) and to get rid of afterwards. It's import-ldif, make-ldif and export-ldif commands could be useful for your work.
I recently wrote godap - a very minimalistic LDAP server library in Go. It doesn't read LDIFs, but you can easily make it response to bind and search operations. (It also may provide insight into the LDAP protocol.)