Splunk Search

SAP audit logs and split a field into new fields

changux
Builder

Hi all.

i have a complex audit log from sap that after parsing looks like:

2AUW20150601081201001213100012Bc        FILE1                           /BL/TASK_SCHEDULER                     8872/BL/TASK_SCHEDULER& 

In SAP "rare world" the first field has the info about programs and returns, for example, the first 4 characters are the kind of operation

2AUW = report.

I am using the definition mentioned in this site:

http://scn.sap.com/thread/3298688

Splunk doesn't do a default field extraction after parsing. How i can "split" the first field in subfields (counting characters) I mean:

1.) First 4 characters are the kind of report.
2.) Other 6 characters the date.
etc (the table with the values is included)

alt text

Any suggest? Thanks!

Tags (3)
0 Karma
1 Solution

woodcock
Esteemed Legend

You do it like this:

... | rex field=MultiField "(?<First4CharField>.{4})(?<Second4CharField>.{4})(?<Third4CharField>.{4})(?<Fourth4CharField>.{4})"

View solution in original post

woodcock
Esteemed Legend

You do it like this:

... | rex field=MultiField "(?<First4CharField>.{4})(?<Second4CharField>.{4})(?<Third4CharField>.{4})(?<Fourth4CharField>.{4})"

changux
Builder

@woodcock, this works:

rex field=_raw "(?<First4CharField>.{4})(?<Second4CharField>.{4})(?<Third4CharField>.{4})(?<Fourth4CharField>.{4})"

How i can set permanently?

Thanks!

0 Karma

woodcock
Esteemed Legend

You put it into config files on your search head like this:

props.conf:

[mysourcetype]
REPORT-fields-by-column-position = fields-by-column-position

transforms.conf:

[fields-by-column-position]
REGEX = (.{4})(.{4})(.{4})(.{4})
FORMAT = First4CharField::$1 Second4CharField::$2 Third4CharField::$3 Fourth4CharField::$4

Don't forget to "Accept" my answer.

changux
Builder

In your FORMAT line:

FORMAT = First4CharField::$1Second4CharField::$2 Third4CharField::$3 Fourth4CharField::$4

You forgot the spaces or doesn't matter?

0 Karma

woodcock
Esteemed Legend

Yes, use spaces (cut and paste error).

0 Karma

changux
Builder

Thanks, i will test. How i can set it permanently? The field extraction is made one by one, right?

0 Karma

changux
Builder

Thanks @woodcock, doesn't work. Any other suggestion?

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...