logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Apache customLog (get part of the URL)
Author
tiquee



Joined: 05 Sep 2018
Posts: 1
Location: Brazil, Curitiba

PostPosted: Wed 05 Sep '18 21:26    Post subject: Apache customLog (get part of the URL) Reply with quote

hi,

I have a customLog (httpd.conf) at my apache 2.4 on a OpenSuse Linux and I'm using the %U to get the URL path requested, not including any query string, but I'd like to get only the first 5 parts of the url.

Example: /part1/part2/part3/part4/part5/part6 should generate the log only until .../part5

Is it possible to do this? I thought about using some regular expression, but I did not find where and how to apply.

Below is my current custom log

Code:
CustomLog "%{%Y/%m/%d %T}t,%{consumerId}i,%m,%>s,%U,%D"
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Mon 10 Sep '18 17:17    Post subject: Reply with quote

You could send the log through a pipe


see: https://httpd.apache.org/docs/2.4/logs.html#piped

google search words:
apache log pipe to script
Back to top


Reply to topic   Topic: Apache customLog (get part of the URL) View previous topic :: View next topic
Post new topic   Forum Index -> Apache