mirror of
https://github.com/LukeHagar/sailpoint-cli.git
synced 2025-12-09 12:47:44 +00:00
simplified parse command, updated help
This commit is contained in:
@@ -325,8 +325,7 @@ var parseHelp string
|
|||||||
|
|
||||||
func newParseCommand() *cobra.Command {
|
func newParseCommand() *cobra.Command {
|
||||||
help := util.ParseHelp(parseHelp)
|
help := util.ParseHelp(parseHelp)
|
||||||
var ccg bool
|
var fileType string
|
||||||
var canal bool
|
|
||||||
var all bool
|
var all bool
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "parse",
|
Use: "parse",
|
||||||
@@ -335,7 +334,9 @@ func newParseCommand() *cobra.Command {
|
|||||||
Example: help.Example,
|
Example: help.Example,
|
||||||
Args: cobra.MinimumNArgs(1),
|
Args: cobra.MinimumNArgs(1),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
if ccg || canal {
|
|
||||||
|
if fileType != "" {
|
||||||
|
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
|
|
||||||
p := mpb.New(
|
p := mpb.New(
|
||||||
@@ -350,7 +351,8 @@ func newParseCommand() *cobra.Command {
|
|||||||
for _, filepath := range args {
|
for _, filepath := range args {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
|
|
||||||
if ccg {
|
switch fileType {
|
||||||
|
case "ccg":
|
||||||
go func(filepath string) {
|
go func(filepath string) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
err := ParseCCGFile(p, filepath, all)
|
err := ParseCCGFile(p, filepath, all)
|
||||||
@@ -358,7 +360,7 @@ func newParseCommand() *cobra.Command {
|
|||||||
log.Error("Issue Parsing log file", "file", filepath, "error", err)
|
log.Error("Issue Parsing log file", "file", filepath, "error", err)
|
||||||
}
|
}
|
||||||
}(filepath)
|
}(filepath)
|
||||||
} else if canal {
|
case "canal":
|
||||||
go func(filepath string) {
|
go func(filepath string) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
err := ParseCanalFile(p, filepath, all)
|
err := ParseCanalFile(p, filepath, all)
|
||||||
@@ -367,21 +369,20 @@ func newParseCommand() *cobra.Command {
|
|||||||
}
|
}
|
||||||
}(filepath)
|
}(filepath)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
wg.Wait()
|
|
||||||
|
|
||||||
return nil
|
}
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
} else {
|
} else {
|
||||||
return errors.New("must specify either ccg or canal")
|
cmd.Help()
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.Flags().BoolVarP(&ccg, "ccg", "", false, "Specifies the provided files are CCG Files")
|
cmd.Flags().StringVarP(&fileType, "type", "t", "", "Specifies the log type to parse (ccg, canal)")
|
||||||
cmd.Flags().BoolVarP(&canal, "canal", "", false, "Specifies the provided files are CANAL Files")
|
|
||||||
cmd.Flags().BoolVarP(&all, "all", "a", false, "Specifies all log traffic should be parsed, not just errors")
|
cmd.Flags().BoolVarP(&all, "all", "a", false, "Specifies all log traffic should be parsed, not just errors")
|
||||||
cmd.MarkFlagsMutuallyExclusive("ccg", "canal")
|
|
||||||
cmd.MarkFlagsMutuallyExclusive("all", "canal")
|
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,21 @@ Parse Log Files from SailPoint Virtual Appliances
|
|||||||
====
|
====
|
||||||
|
|
||||||
==Example==
|
==Example==
|
||||||
|
|
||||||
|
## Parsing CCG Logs:
|
||||||
|
|
||||||
|
All the errors will be parsed out of the log file and sorted by date and connector name.
|
||||||
|
|
||||||
|
Supplying the `--all` flag will parse all the log traffic out, not just errors.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sail va parse --ccg ./path/to/ccg.log ./path/to/ccg.log
|
sail va parse --type ccg ./path/to/ccg.log ./path/to/ccg.log
|
||||||
sail va parse --canal ./path/to/canal.log ./path/to/canal.log
|
sail va parse --type ccg ./path/to/ccg.log ./path/to/ccg.log --all
|
||||||
|
```
|
||||||
|
|
||||||
|
## Parsing CANAL Logs:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sail va parse --type canal ./path/to/canal.log ./path/to/canal.log
|
||||||
```
|
```
|
||||||
====
|
====
|
||||||
|
|||||||
Reference in New Issue
Block a user