Splunk Search

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

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

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, an upvote would be appreciated.
0 Karma

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

SplunkTrust
SplunkTrust

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

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