Splunk Search

Powershell: How to parse epoch stamped DB files for a specific date range and move those files to thaweddb?

jward6004
Explorer

I'm trying to automate a task for moving db files from a specified date range to the thaweddb so that my teams can search this data even after the normal data retention limits have been reached. Our company does a lot of business over holiday periods, i.e. the week of Christmas, Valentine's Day, etc. and we need to be able to compare trends from past holidays. Since the db files are epoch date and time stamped, the script will need to be able to sparse the db directory reading epoch time looking for the specified date range and then once it identifies those files, move them to thaweddb. Has anyone tried to do anything similar to this that might be able to give me some hints on how to piece this together? Thanks in advance!

0 Karma

richgalloway
SplunkTrust
SplunkTrust

db directory names are in the format db_<startTime>_<endTime>_n. Start and end times are in epoch format, which is the number of seconds since 12/31/69 23:59:59. You should be able to find some code on-line to convert the epoch timestamps into Windows time or whatever else your script needs.

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

jward6004
Explorer

@richgalloway, thanks I've already found docs online to use powershell to convert epoch to regular time such as this :

http://stackoverflow.com/questions/10781697/convert-unix-time-with-powershell

However, I'm trying to figure out the structure and parse portions of the intended script.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

I don't know enough about powershell to help with that part. Sorry.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Index This | I’m short for "configuration file.” What am I?

May 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with a Special ...

New Articles from Academic Learning Partners, Help Expand Lantern’s Use Case Library, ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Your Guide to SPL2 at .conf24!

So, you’re headed to .conf24? You’re in for a good time. Las Vegas weather is just *chef’s kiss* beautiful in ...