Powershell install & config generate of Filebeat for IIS in EC2

A lot of acronyms.  So we have a pile of IIS servers in EC2 and want to get the IIS logs into our ELK.  After much mental anguish I chose this method.  Why?  Because in our test environments you might have a bunch of IIS sites on one server, whereas in staging/production you'd only have one or two.  So having a bunch of filebeat.ymls kicking around seemed silly.  So this looks at your IIS config and dynamically creates the filebeat.yml based on those results!

Here's the gist: https://gist.github.com/christrotter/143decafb217be355a93930be60d90d9

That script will generate your filebeat.yml with a prospector for each IIS site.  It adds an 'application_name' field (part of our internal naming convention, set this to whatever) with the site name (e.g. www.domain.com).  Ideally you'd have EC2 tags for all that, but hay.  Iteration1 and all that.

It can also be run over and over (e.g. for testing config file changes); somewhat idempotent.

We run this as part of our EC2 server build process (pull down repo using userdata, run scripts) - after the code is deployed for the first time.  We could even slot this in to our deploy process I suppose... hm.

You can also take this process and reconfigure for any kind of Windows log file.  I am moving on to Winlogbeat next - should be much easier.  :)

Hope it helps someone!

Comments

Popular posts from this blog

Learning through failure - a keyboard creation journey

Learning Opportunities - Watching/listening list

DFSR - eventid 4312 - replication just won't work