Send Sample Data to Loggly using PowerShell

I’ve been investigating the viability of logging from PowerShell scripts to Loggly, and I came across their “Send Sample Data to Loggly” intro page. They instruct Windows users to install and use cURL to send their data to the API, but this isn’t necessary if you have PowerShell 3.0 or newer.

Just run the following one-liner in a PowerShell console window:

(wget "http://www.loggly.com/install/LogglySample.log").RawContent | iwr -Method Post -Uri "https://logs-01.loggly.com/bulk/CUSTOMER_TOKEN/tag/sample" -ContentType "text/plain" 

Note: ‘iwr’ and ‘wget’ as used above are both aliases for the Invoke-WebRequest cmdlet:

image

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s