Skip to content

Commit

Permalink
对于ebpflowexport的输出进行格式化输出
Browse files Browse the repository at this point in the history
  • Loading branch information
NaNShaner committed Apr 5, 2022
1 parent 264d899 commit 9d4cd9d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion go/fmtflow/fmtflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ type ContainerInfo struct {
func main() {
_cmdEbpflowexport := flag.String("c", "", "请输入ebpflowexport可执行文件的绝对路径")
flag.Parse()
if *_cmdEbpflowexport == "" {
log.Fatalf("请输入ebpflowexport可执行文件的绝对路径")
} else {
_, err := os.Stat(*_cmdEbpflowexport)
if err != nil {
log.Fatalf("ebpflowexport可执行文件的绝对路径不存在,%s", *_cmdEbpflowexport)
}
}
_, err := os.Stat(*_cmdEbpflowexport)
if err != nil {
log.Fatalf("%s文件不存在", *_cmdEbpflowexport)
Expand Down Expand Up @@ -114,7 +122,7 @@ func getFieldToStuct(f string) (Ebpfflow, error) {
for i := 1; i < len(lineSplit); i++ {
flowSplit = append(flowSplit, lineSplit[i])
}
fmt.Printf("%s\n", line)
//fmt.Printf("%s\n", line)

ebpfflow.EventTime = flowSplit[0]
ebpfflow.Ifname = flowSplit[1]
Expand Down

0 comments on commit 9d4cd9d

Please sign in to comment.