Refine your search:

I have an Apache Access log which I'm searching for any .cgi or .pl file hit with the latest date it's been hit.

Some of the .cgi or .pl do get parameters passed after the question mark (ie test.pl?user=nobody&location=uk). I don't want to capture that information.

So, basically, I'd like to have a table with two columns - cgi/pl name (full path so we ensure we get the right one), and the last time it was hit.

Is that possible?

asked 09 Jul '10, 19:47

Brian%20Osburn's gravatar image

Brian Osburn
2.8k13
accept rate: 22%

edited 09 Jul '10, 20:08

Lowell's gravatar image

Lowell ♦
9.6k637


One Answer:

Should be able to do this with a search like this:

sourcetype=access_common (.cgi OR .pl) | stats max(_time) as last_time by uri_path | convert ctime(last_time)

The uri_path field should contain evertying up to the .pl or .cgi but not any of the args (the stuff after ?)

link

answered 09 Jul '10, 20:06

Lowell's gravatar image

Lowell ♦
9.6k637
accept rate: 40%

1

In order for Lowell's search to work, your Apache Access log needs to be sourcetyped access_common. If it is not (e.g. you are using your own sourcetype), the uri_path field need to be defined.

(12 Jul '10, 21:05) hulahoop ♦
Post your answer
toggle preview

Follow this question

Log In to enable email subscriptions

RSS:

Answers

Answers + Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×210
×37

Asked: 09 Jul '10, 19:47

Seen: 499 times

Last updated: 09 Jul '10, 20:08

Copyright © 2005-2012 Splunk, Inc. All rights reserved.