Feature/change output timeformat#154 (#194)
* changed default output time format #154 * added time zone #154 * added rfc3339 option #154
This commit is contained in:
@@ -118,8 +118,10 @@ where
|
||||
{
|
||||
if configs::CONFIG.read().unwrap().args.is_present("rfc-2822") {
|
||||
return time.to_rfc2822();
|
||||
} else {
|
||||
} else if configs::CONFIG.read().unwrap().args.is_present("rfc-3339") {
|
||||
return time.to_rfc3339();
|
||||
} else {
|
||||
return time.format("%Y-%m-%d %H:%M:%S%.3f %:z").to_string();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +171,10 @@ fn test_emit_csv() {
|
||||
.unwrap();
|
||||
let expect_tz = expect_time.with_timezone(&Local);
|
||||
let expect = "Time,Filepath,Rulepath,Level,Computername,Eventid,Alert,Details\n".to_string()
|
||||
+ &expect_tz.clone().format("%Y-%m-%dT%H:%M:%S%:z").to_string()
|
||||
+ &expect_tz
|
||||
.clone()
|
||||
.format("%Y-%m-%d %H:%M:%S%.3f %:z")
|
||||
.to_string()
|
||||
+ ","
|
||||
+ &testfilepath.replace(".evtx", "").to_string()
|
||||
+ ","
|
||||
|
||||
@@ -50,6 +50,7 @@ fn build_app<'a>() -> ArgMatches<'a> {
|
||||
let usages = "-f --filepath=[FILEPATH] 'Event file path'
|
||||
--csv-timeline=[CSV_TIMELINE] 'Csv output timeline'
|
||||
--rfc-2822 'Output date and time in RFC 2822 format. Example: Mon, 07 Aug 2006 12:34:56 -0600'
|
||||
--rfc-3339 'Output date and time in RFC 3339 format. Example: 2006-08-07T12:34:56.485214 -06:00'
|
||||
-l --lang=[LANG] 'Output language'
|
||||
-L --level=[LEVEL] 'Specified execute rule level(default: INFO)'
|
||||
-u --utc 'Output time in UTC format(default: local time)'
|
||||
|
||||
Reference in New Issue
Block a user