Refine your search:

In Splunk 4.0, how can I extract fields from W3C Extended Log format files? (W3C Extended Log format is the standard log file format used by Windows' IIS web server).

Sure, I can manually create fields in props.conf or inside my search query using regexes, but that's fragile if I start logging different fields on each site or server.

The field names are sitting on top of the IIS log file. Can Splunk detect those fields like it does with CSV files?

asked 13 Jan '10, 02:12

Justin%20Grant's gravatar image

Justin Grant
1.5k6739
accept rate: 50%


8 Answers:

Yeah, just put these lines in etc\apps\search\local\props.conf

[iis]
CHECK_FOR_HEADER = true

That is one of many possible locations, but I'm keeping it simple.

It is extremely useful, and probably one of the first things about configuring Splunk that should be learned, to really read and understand the configuration file priority and merging and rules:

http://www.splunk.com/base/Documentation/latest/Admin/Aboutconfigurationfiles

and also I strongly recommend:

http://www.splunk.com/base/Documentation/latest/Admin/Troubleshootingconfigurations

This is pretty much the foundation of how to manage Splunk, how to deploy it, and how to develop apps in a structured way.

link

answered 13 Jan '10, 23:55

gkanapathy's gravatar image

gkanapathy ♦
26.3k1622
accept rate: 42%

edited 14 Jan '10, 06:26

Johnvey's gravatar image

Johnvey ♦♦
2.2k1217

Minor tweak: do not edit a file in a 'default' directory, as it will be overwritten on upgrade.

Instead, modify Splunk/etc/system/local/props.conf to set this value:

[iis]
CHECK_FOR_HEADER = true

Of course, if iis always has headers, this setting should be pushed upstream to be there by default.

link

answered 14 Jan '10, 01:36

jrodman's gravatar image

jrodman ♦
5.8k2515
accept rate: 42%

In v4.1.4 I see that CHECK_FOR_HEADER is set to true by default. So this has been set by upstream as default :)

link

answered 26 Jul '10, 11:15

Joffer's gravatar image

Joffer
1489
accept rate: 25%

As I found out via some experimentation, Splunk can automatically extract fields from IIS log files but you'll need to:

First, edit \Program Files\SplunkBeta\etc\system\default\props.conf to change this:

[iis] 
pulldown_type = true 
MAX_TIMESTAMP_LOOKAHEAD = 32 
SHOULD_LINEMERGE = False

to this:

[iis] 
pulldown_type = true 
MAX_TIMESTAMP_LOOKAHEAD = 32 
SHOULD_LINEMERGE = False 
CHECK_FOR_HEADER = true

(Note the last line)

Second, when you import the log files or set up the directory monitor, manually specify the "iis" sourcetype (you can choose this from the dropdown list or type it in).

If you've already imported the files without doing both of those steps, I've not figured out how to get this to work. So be sure to do the config change before you try to imoprt the files!

Another caveat: you're not really supposed to be editing the system props.conf directly. If someone more knowledgeable about splunk wants to comment with the proper placed to edit, I'll revise this answer.

link

answered 13 Jan '10, 02:22

Justin%20Grant's gravatar image

Justin Grant
1.5k6739
accept rate: 50%

we do not recommend you edit files in the default directory because any changes you make there would be undone during an upgrade. The recommended way of doing this is to edit the files in the local directory as follows:

SPLUNK_HOME/etc/system/local/props.conf

[iss]
CHECK_FOR_HEADER = true
link

answered 14 Jan '10, 19:06

Ledion%20Bitincka's gravatar image

Ledion Bitincka ♦
1.5k36
accept rate: 35%

Do you have to set this on the light forwarder? I've set this up on the indexer, but it doesn't seem to have done anything.

link

answered 12 Aug '10, 18:26

stjack99's gravatar image

stjack99
856
accept rate: 40%

FYI : the best guide to fix IIS sourcetype and have the correct field extractions

http://splunk-base.splunk.com/answers/1902/iis-and-exchange-log-header-extraction

link

answered 14 Oct '11, 11:47

yannK's gravatar image

yannK
3.8k47
accept rate: 33%

@stjack,

The lightweight forwarder will simply be attaching a few pieces of metadata along to the indexer(s).

That said, I got this to work when it was a single machine doing the indexing and searching, but for a distributed instance the header field extraction only seemed to work once and a while, and on smaller subsets of data. I know CHECK_FOR_HEADER is kind of an older, less focused on feature. Does it not always work right with distributed search?

link

answered 10 Nov '10, 20:13

kevintelford's gravatar image

kevintelford
2208
accept rate: 30%

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:

×351
×46

Asked: 13 Jan '10, 02:12

Seen: 5,353 times

Last updated: 14 Oct '11, 11:47

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