Getting Data In

Need to parse or eliminate -----------------------------------------------------------------

VijaySrrie
Builder

Hi,

Out of 100 logs one of my log is --------------------------------------------------------
How to parse or eliminate this?

0 Karma
1 Solution

efavreau
Motivator

Hi @vijaysri! There are some options I have outlined below. There may be more. It starts with your admins and ends with what I would try first.
1. If this is a log source, you can remove it by changing the source in your SPL to: source!=mydashedlinelogsource This will ignore that log source. Although if this is the case, you might want your admins to stop ingesting that log file. I will assume it's not a log source for the other options.
2. If you want to give this line a name, so you can exclude it later in your search, you could use a regular expression to capture it and a search to filter it out. This isn't a great approach, because it's inefficient, but it works. This assumes the dashed line is of the same known length. Test it to make sure you aren't excluding other useful files.
| rex field=_raw (?<DashedLineLog>(--------------------------------------------------------)) | search DashedLineLog!=*
3. There's another option besides writing the regular expression yourself. You can use the Field Extractor, which would work very well for this scenario: https://docs.splunk.com/Documentation/Splunk/Latest/Knowledge/ExtractfieldsinteractivelywithIFX
4. However, if you know the dashed line is of the same known length every time, because it's an entire log event, or there's nothing else in the log event that you care about, you could before the first pipe ( | ) in your search query , put in NOT "--------------------------------------------------------", and this will eliminate those log events containing that string. Test it to make sure you aren't excluding other useful files. This would be my first approach, because anything you can put before the first pipe will improve search performance.

Good luck!

###

If this reply helps you, an upvote would be appreciated.

View solution in original post

0 Karma

to4kawa
Ultra Champion

set LINE_BREAKER= (--{40}) in _props.conf

0 Karma

VijaySrrie
Builder

Hi All,

Below one worked:

I created transforms.conf
transforms.conf
[setnull]
REGEX = -+
DEST_KEY = queue
FORMAT = nullQueue

In props.conf added the line
TRANSFORMS-null = setnull

0 Karma

efavreau
Motivator

Hi @vijaysri! There are some options I have outlined below. There may be more. It starts with your admins and ends with what I would try first.
1. If this is a log source, you can remove it by changing the source in your SPL to: source!=mydashedlinelogsource This will ignore that log source. Although if this is the case, you might want your admins to stop ingesting that log file. I will assume it's not a log source for the other options.
2. If you want to give this line a name, so you can exclude it later in your search, you could use a regular expression to capture it and a search to filter it out. This isn't a great approach, because it's inefficient, but it works. This assumes the dashed line is of the same known length. Test it to make sure you aren't excluding other useful files.
| rex field=_raw (?<DashedLineLog>(--------------------------------------------------------)) | search DashedLineLog!=*
3. There's another option besides writing the regular expression yourself. You can use the Field Extractor, which would work very well for this scenario: https://docs.splunk.com/Documentation/Splunk/Latest/Knowledge/ExtractfieldsinteractivelywithIFX
4. However, if you know the dashed line is of the same known length every time, because it's an entire log event, or there's nothing else in the log event that you care about, you could before the first pipe ( | ) in your search query , put in NOT "--------------------------------------------------------", and this will eliminate those log events containing that string. Test it to make sure you aren't excluding other useful files. This would be my first approach, because anything you can put before the first pipe will improve search performance.

Good luck!

###

If this reply helps you, an upvote would be appreciated.
0 Karma

VijaySrrie
Builder

Hi All,

Below one worked:

I created transforms.conf
transforms.conf
[setnull]
REGEX = -+
DEST_KEY = queue
FORMAT = nullQueue

In props.conf added the line
TRANSFORMS-null = setnull

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @vijaysri,
if you can find a regex to parse this event it's possible to eliminate it.
Can you share an example of your logs?

Ciao.
Giuseppe

0 Karma
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...