Splunk Search

rename EventCodes

smudge797
Path Finder

Is there a way to rename EventCodes xxxx field to "description" in timechart? Here is a sample search:

Account_Name=* (EventCode=4800 OR EventCode=4801 OR EventCode=4768) index=blah sourcetype="WinEventLog:Security" source="WinEventLog:Security" | timechart count by EventCode

Thanks!

0 Karma

chimell
Motivator

hi smudge797
you say that my answer is good . Now vote it .

0 Karma

DMohn
Motivator

You should use a csv-Lookup here...

Just follow these steps:

  1. Create a csv-file containing the EventCodes and the Description you could use this site as a reference for the csv: https://www.ultimatewindowssecurity.com/securitylog/encyclopedia/default.aspx
  2. Upload the csv-file to Splunk via Settings -> Lookups -> Lookup Table files -> New
  3. optional: Create a lookup-Definition and a automatic lookup for your sourcetype (reference here: http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Addfieldsfromexternaldatasources)
  4. Use the lookup to add the additional knowledge data

Assuming your csv has the name winevents.csv and has this structure:

 EventCode,Description
 513,Windows is shutting down
 514,An authentication package has been loaded by the Local Security Authority

this would be your search:

 Account_Name=* (EventCode=4800 OR EventCode=4801 OR EventCode=4768) index=blah sourcetype="WinEventLog:Security" source="WinEventLog:Security" | lookup winevents.csv EventCode OUTPUT Description | timechart count by Description
0 Karma

rashid47010
Communicator

hi I am following the guideline but i am facing the error: Could not find all of the specified lookup fields in the lookup table" Please advise

0 Karma

alemarzu
Motivator

Hi smudge,

Did you try CSV lookups ? Check this out

http://docs.splunk.com/Documentation/Splunk/6.2.1/Knowledge/Addfieldsfromexternaldatasources#CSV_loo...

Hope it helps!

0 Karma

fdi01
Motivator

you can use replace command to do it .

try like this:

... | replace 4800 with "The workstation was locked" in EventCode| replace 4801 with "The workstation was unlocked" in EventCode|.....

chimell
Motivator

Hi
I rectified use case statement and retry

 Account_Name=* (EventCode=4800 OR EventCode=4801 OR EventCode=4768) index=blah sourcetype="WinEventLog:Security" source="WinEventLog:Security"|eval description=case(EventCode=="4768","A Kerberos authentication ticket (TGT) was requested and User Logged in", EventCode=="4800" , "The workstation was locked" , EventCode=="4801" , "The workstation was unlocked") | timechart count by description
0 Karma

smudge797
Path Finder

Thanks but i need the description to be something like:
4768 A Kerberos authentication ticket (TGT) was requested
4800 The workstation was locked
4801 The workstation was unlocked
4768 User Logged in

Rather than just listing the event codes.

0 Karma

chimell
Motivator

just retry my new search code above

0 Karma

smudge797
Path Finder

This worked from Chimell. Thanks

Account_Name=* (EventCode=4800 OR EventCode=4801 OR EventCode=4768) index=blah sourcetype="WinEventLog:Security" source="WinEventLog:Security"|eval description=case(EventCode=="4768","A Kerberos authentication ticket (TGT) was requested and User Logged in", EventCode=="4800" , "The workstation was locked" , EventCode=="4801" , "The workstation was unlocked") | timechart count by description

fdi01
Motivator

go accept and upvote answer of Mm chimell if you agree Mm smudge797
thanks.

0 Karma

smudge797
Path Finder

Nice! Thanks

0 Karma

chimell
Motivator

where are the query that you propose ?

0 Karma

fdi01
Motivator

i ok with Mm chimell where is your answer Mm smudge797
post your answer because it can help somebody
thanks.

0 Karma
Get Updates on the Splunk Community!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...