Question: I have a web server running on my Mac and I'd like to be notified (via Growl for example) when someone accesses my server.

I searched for something like that in Automator but found nothing.

Do you know if this is possible ?

Thank you.

Answer: 
The key is your access logs. Assuming your webserver is properly configured, each time a page is served it should provide some level of detail in the access logs. This can be turned off for sites with enourmous traffic loads, but for your bog standard (assuming) apache install on a local machine I imagine you are not looking as a massive load.

So, what you need is a method to examine the access log periodically (or real time) either by checking timestamps, or tailing the content etc. Once this is sorted, you need a way to push it into growl. Growlnotify is a command line utility that will accept output from other commands and use it as the basis to provide a graphical growl notification.

At this point you need to decide if you want a simple "You have visitors!" message, or something that includes the details, say which page was served to which IP address etc. That's your choice, and makes the code you need to write that bit more complex or simple.

Check the following example (sorry, I use ksh, you may need to modify):

```
#!/bin/ksh
while read access
do
growlnotify -t "HTTP_Access" -m "You have visitors!
done < /http/access/log/folder/log1.log

```

Obviously this will churn out far too much info and be generic, so you need to add your own special blend of a) configuring Apache to only log to the level you need, and b) filter out the entries anyway, possibly formatting while you go, e.g.:

```
#!/bin/ksh
while read access
do
formatted_access=`echo $access | grep -v "unwanted strings" | awk '{print "Time "$1", IP"$4}'`
count =`echo $formatted_access | wc -l`
case $count in
(0)
# No line matched criteria
;;
(*)
growlnotify -t "HTTP_Access" -m $formatted_access
;;
esac
done < /http/access/log/folder/log1.log

```

Throw this into an automator service, and away you go.
Growl can probably do this for you automatically:

![enter image description here](https://i.stack.imgur.com/9mBmw.png)