Splunk Search

Not automatically recognizing fields

jamesklassen
Path Finder

I have data that is not being recognized. A PowerShell script outputs data (that I copied to a file for testing) that looks like this:

Identity = MAILHUB2\45191, DeliveryType = SmtpRelayToTiRg, Status = Ready, MessageCount = 0
Identity = MAILHUB2\45210, DeliveryType = MapiDelivery, Status = Ready, MessageCount = 0
Identity = MAILHUB2\45226, DeliveryType = MapiDelivery, Status = Ready, MessageCount = 0
Identity = MAILHUB2\45235, DeliveryType = MapiDelivery, Status = Ready, MessageCount = 0

I formatted the PowerShell output like what I saw in the manual, which described the formatting as "Splunk loves these files. It eats them like jam (or chocolate)", from http://www.splunk.com/base/Documentation/latest/AppManagement/Getdata.

Well it doesn't like that formatting! I've played with this endlessly, changing commas, replacing = with :...no luck.

Splunk idexes it like this:

1
11/25/10 1:56:07.000 PM
geCount = 0 host=localhost Options| sourcetype=access_combined Options| source=script Options

2
11/25/10 1:56:07.000 PM
Identity = MAILHUB1\Submission, DeliveryType = Undefined, Status = Ready, Messa host=localhost Options| sourcetype=access_combined Options| source=script Options

3
11/25/10 1:56:07.000 PM
Count = 0 host=localhost Options| sourcetype=access_combined Options| source=script Options

Please help! Thanks.

0 Karma
1 Solution

jamesklassen
Path Finder

I figured it out. I tried doing it as CSV, where the first line contains the column headings. I set the script sourcetype to csv-4. Here's the powershell formatting:


write-host "Identity, DeliveryType, Status, MessageCount"

$output = $queue.identity.ToString() + ", " + $queue.deliverytype + ", " + $queue.status + ", " + $queue.MessageCount

$output


Splunk now recognizes the field names, and I can alert on when my queues fill up...

View solution in original post

0 Karma

gkanapathy
Splunk Employee
Splunk Employee

You should either put timestamps in your data, or set DATETIME_CONFIG = CURRENT for your sourcetype.

jamesklassen
Path Finder

I figured it out. I tried doing it as CSV, where the first line contains the column headings. I set the script sourcetype to csv-4. Here's the powershell formatting:


write-host "Identity, DeliveryType, Status, MessageCount"

$output = $queue.identity.ToString() + ", " + $queue.deliverytype + ", " + $queue.status + ", " + $queue.MessageCount

$output


Splunk now recognizes the field names, and I can alert on when my queues fill up...

0 Karma

jamesklassen
Path Finder

The data has a new line for each piece of data, I'm not sure why it's not formatted like that above. Each line starts with Identity

0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...