我有一些关于导入到 Splunk 的文件的 CSV 数据。数据如下所示:
"\\domain\path\to\file\","<filename>","<fsize>","<ext>","<Last_access>","<last_write>","<creation_time>","<attributes>","<owner>"
我已使用以下方法将所有日期字符串转换为纪元:
| eval epoch_LastAccessTime=strptime(LastAccessTime, "%d/%m/%Y %H:%M:%S")
...
...
我想得到:
- 上次访问的文件百分比是在 6 个月到 3 年前之间
- 上次访问的文件的百分比是 3 年或更长时间前。
这是我在卡住之前尝试过的搜索查询:
index="<my_index>" sourcetype="<my_sourcetype>"
| rex field=DirectoryName "\\\domain\.org\\\teams\\\(?<Team>[^\\\]*)"
offset_field=_extracted_fields_bounds
| eval epoch_LastAccessTime=strptime(LastAccessTime, "%d/%m/%Y
%H:%M:%S")
| eval _time=epoch_LastAccessTime
| timechart span=6mon count
我尝试过使用以下命令:
| where epoch_LastAccessTime>=three_year_ago_from_now AND
epoch_LastAccessTime<=six_months_ago_from_now
但是,这不包括其他所有内容(3y+)
我希望结果看起来像:
TimeRange Perc
6m-3y 60%
3y+ 40%