Splunk Search

How to extract fields from bluecoat logs?

TheGU
Path Finder

How to extract the log example below:

2010-09-29 16:23:44 2 172.16.106.54 exam.ple Filter-ID==4 - OBSERVED "Search Engines/Portals;News/Media" http://market.example.com/product/1439306 200

I got this from bluecoat server. I can't use DELIMS=" " to extract KV because some fields have a " " (spacebar) too.

for extraction example :

Tags (1)
0 Karma
1 Solution

ziegfried
Influencer

You could use a regular expression to extract the fields. Something like this:

props.conf

[your_sourcetype]
EXTRACT-fields=^[\d\-]+) [\d:]+ (?<FIELD_1>\d+) (?<clientip>[\d\.]+) (?<domain>\S+) Filter\-ID==(?<filter_id>\S+) "(?<url_category>[^"]+)" (?<url>\S+) (?<status>\d+)

View solution in original post

0 Karma

Peterman
Explorer

@TheGU wrote:

How to extract the log example below:

2010-09-29 16:23:44 2 172.16.106.54 exam.ple Filter-ID==4 - OBSERVED "Search Engines/Portals;News/Media" http://market.example.com/product/1439306 200

I got this from bluecoat server. I can't use DELIMS=" " to extract KV because some fields have a " " (spacebar) too.

for extraction example :


bluecoat server is awsome man 

0 Karma

ziegfried
Influencer

You could use a regular expression to extract the fields. Something like this:

props.conf

[your_sourcetype]
EXTRACT-fields=^[\d\-]+) [\d:]+ (?<FIELD_1>\d+) (?<clientip>[\d\.]+) (?<domain>\S+) Filter\-ID==(?<filter_id>\S+) "(?<url_category>[^"]+)" (?<url>\S+) (?<status>\d+)
0 Karma

TheGU
Path Finder

I found that transaction may be up to 2kB. Very hard to write a regex to cover all of them. However your answer is Ok. Thanks.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...