nerdalert / nflow-generator

NetFlow Generator for Testing Flow Collection Apps
Apache License 2.0
107 stars 46 forks source link

Issue with running nflow-generator in go #5

Open idanbenyair opened 5 years ago

idanbenyair commented 5 years ago

Hello,

Thanks a lot for this cool generator! I use it a lot. Works great. I use the docker container. But now I have a requirement to use the go version. I am facing this issue (I'm pretty sure I am doing something wrong):

root@kafka-west-209-107:/home/ubuntu/nflow-generator# go build nflow_logging.go:4:2: cannot find package "github.com/Sirupsen/logrus" in any of: /usr/lib/go-1.6/src/github.com/Sirupsen/logrus (from $GOROOT) /root/Sirupsen/logrus/src/github.com/Sirupsen/logrus (from $GOPATH) nflow-generator.go:10:2: cannot find package "github.com/jessevdk/go-flags" in any of: /usr/lib/go-1.6/src/github.com/jessevdk/go-flags (from $GOROOT) /root/Sirupsen/logrus/src/github.com/jessevdk/go-flags (from $GOPATH)


What should I do per the exports?

nerdalert commented 5 years ago

Hey Idan!

You just need to pull down the libraries used in the code and cache them on your local machine.

go get github.com/Sirupsen/logrus
go get github.com/jessevdk/go-flags

I did a quick example to showing how to resolve it.

brent@ub-230:~/nflow-generator$ ls
Dockerfile  LICENSE  nflow-generator.go  nflow_logging.go  nflow_payload.go  nflow_spike.go  README.md
brent@ub-230:~/nflow-generator$ go build
nflow_logging.go:4:2: cannot find package "github.com/Sirupsen/logrus" in any of:
    /usr/local/go/src/github.com/Sirupsen/logrus (from $GOROOT)
    /home/brent/go/src/github.com/Sirupsen/logrus (from $GOPATH)
nflow-generator.go:10:2: cannot find package "github.com/jessevdk/go-flags" in any of:
    /usr/local/go/src/github.com/jessevdk/go-flags (from $GOROOT)
    /home/brent/go/src/github.com/jessevdk/go-flags (from $GOPATH)
brent@ub-230:~/nflow-generator$ go get github.com/Sirupsen/logrus
brent@ub-230:~/nflow-generator$ go get github.com/jessevdk/go-flags
brent@ub-230:~/nflow-generator$ go build
brent@ub-230:~/nflow-generator$ ls
Dockerfile  LICENSE  nflow-generator  nflow-generator.go  nflow_logging.go  nflow_payload.go  nflow_spike.go  README.md

I also added a binary to download the Linux binary here nflow-generator-x86_64-linux

Let me know if this unblocks you. Thanks!

idanbenyair commented 5 years ago

Hey thanks for responding!

I did get these packages but after doing so I hit this error:

root@kafka-west-209-107:/home/ubuntu/projects/nflow-generator# go build /usr/lib/go-1.6/src/github.com/sirupsen/logrus/entry.go:5:2: cannot find package "context" in any of: /usr/lib/go-1.6/src/vendor/context (vendor tree) /usr/lib/go-1.6/src/context (from $GOROOT) ($GOPATH not set)

I guess missing some context package.

How do I use the binary? Just need to run that?


From: Brent Salisbury notifications@github.com Sent: Friday, April 5, 2019 2:08 PM To: nerdalert/nflow-generator Cc: Idan; Author Subject: Re: [nerdalert/nflow-generator] Issue with running nflow-generator in go (#5)

Hey Idan!

You just need to pull down the libraries used in the code. I did a quick example to show you how to resolve it.

brent@ub-230:~/nflow-generator$ ls Dockerfile LICENSE nflow-generator.go nflow_logging.go nflow_payload.go nflow_spike.go README.md brent@ub-230:~/nflow-generator$ go build nflow_logging.go:4:2: cannot find package "github.com/Sirupsen/logrus" in any of: /usr/local/go/src/github.com/Sirupsen/logrus (from $GOROOT) /home/brent/go/src/github.com/Sirupsen/logrus (from $GOPATH) nflow-generator.go:10:2: cannot find package "github.com/jessevdk/go-flags" in any of: /usr/local/go/src/github.com/jessevdk/go-flags (from $GOROOT) /home/brent/go/src/github.com/jessevdk/go-flags (from $GOPATH) brent@ub-230:~/nflow-generator$ go get github.com/Sirupsen/logrus brent@ub-230:~/nflow-generator$ go get github.com/jessevdk/go-flags brent@ub-230:~/nflow-generator$ go build brent@ub-230:~/nflow-generator$ ls Dockerfile LICENSE nflow-generator nflow-generator.go nflow_logging.go nflow_payload.go nflow_spike.go README.md

I also added a binary to download the Linux binary here nflow-generator-x86_64-linuxhttps://github.com/nerdalert/nflow-generator/blob/master/binaries/nflow-generator-x86_64-linux

Let me know if this unblocks you. Thanks!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/nerdalert/nflow-generator/issues/5#issuecomment-480371191, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHWTaDp8JzQlkBKHVoZy1_C4r-mCxZwWks5vd5EegaJpZM4cWb-x.

nerdalert commented 5 years ago

Heya! Trying upgrading to Go v1.7+. https://stackoverflow.com/questions/42802278/install-context-package-in-golang

Regarding the binary, just download and give chmod +x status and you are good to go on a Linux host.

Cheers!

idanbenyair commented 5 years ago

Hey,

So I am having all kind of issue now after I made the change to the go version. I think I need to start from scratch with a new machine. However the binary works! Question is. Is it possible to send to multiple destinations at once? Also, with the binary if I make changes to the nflow-generator.go file that is in the root directory would that apply changes to the generator? Or is the binary independent of the go files?


From: Brent Salisbury notifications@github.com Sent: Monday, April 8, 2019 4:11 PM To: nerdalert/nflow-generator Cc: Idan; Author Subject: Re: [nerdalert/nflow-generator] Issue with running nflow-generator in go (#5)

Heya! Trying upgrading to Go v1.7+. https://stackoverflow.com/questions/42802278/install-context-package-in-golang

Regarding the binary, just download and give chmod +x status and you are good to go on a Linux host.

Cheers!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/nerdalert/nflow-generator/issues/5#issuecomment-480988335, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHWTaI9CkYQP1IIq53lBOgFE5oSF4Rbdks5ve6JXgaJpZM4cWb-x.

idanbenyair commented 5 years ago

BTW I was going through the packages a few days ago. And I got to a point where I had all the right packages. But at the end the error I got was a long the lines of a conflict between sirupsen and Sirupsen. Apparently theres two packages. One with a capital S and another with a lower case. I attempted to correct that in the go files but that was still popping up. From my little research I found that its z known issue with that package.

I'll still try to fix that but I think the binary works well. Just trying to figure out sending to multiple destinations. I might use a proxy for that.

Get Outlook for Androidhttps://aka.ms/ghei36


From: Idan Ben yair idan.benyair@live.com Sent: Monday, April 8, 2019 4:29:38 PM To: nerdalert/nflow-generator Subject: Re: [nerdalert/nflow-generator] Issue with running nflow-generator in go (#5)

Hey,

So I am having all kind of issue now after I made the change to the go version. I think I need to start from scratch with a new machine. However the binary works! Question is. Is it possible to send to multiple destinations at once? Also, with the binary if I make changes to the nflow-generator.go file that is in the root directory would that apply changes to the generator? Or is the binary independent of the go files?


From: Brent Salisbury notifications@github.com Sent: Monday, April 8, 2019 4:11 PM To: nerdalert/nflow-generator Cc: Idan; Author Subject: Re: [nerdalert/nflow-generator] Issue with running nflow-generator in go (#5)

Heya! Trying upgrading to Go v1.7+. https://stackoverflow.com/questions/42802278/install-context-package-in-golang

Regarding the binary, just download and give chmod +x status and you are good to go on a Linux host.

Cheers!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/nerdalert/nflow-generator/issues/5#issuecomment-480988335, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHWTaI9CkYQP1IIq53lBOgFE5oSF4Rbdks5ve6JXgaJpZM4cWb-x.

idanbenyair commented 5 years ago

Got it to work with go 1.12 on a new machine. Thanks a lot!


From: Brent Salisbury notifications@github.com Sent: Monday, April 8, 2019 4:11 PM To: nerdalert/nflow-generator Cc: Idan; Author Subject: Re: [nerdalert/nflow-generator] Issue with running nflow-generator in go (#5)

Heya! Trying upgrading to Go v1.7+. https://stackoverflow.com/questions/42802278/install-context-package-in-golang

Regarding the binary, just download and give chmod +x status and you are good to go on a Linux host.

Cheers!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/nerdalert/nflow-generator/issues/5#issuecomment-480988335, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHWTaI9CkYQP1IIq53lBOgFE5oSF4Rbdks5ve6JXgaJpZM4cWb-x.

idanbenyair commented 5 years ago

Hey Brent,

Is there a good way to log the flow locally (from where the generator is running)?

Get Outlook for Androidhttps://aka.ms/ghei36


From: Idan Ben yair idan.benyair@live.com Sent: Tuesday, April 9, 2019 10:20:46 AM To: nerdalert/nflow-generator Subject: Re: [nerdalert/nflow-generator] Issue with running nflow-generator in go (#5)

Got it to work with go 1.12 on a new machine. Thanks a lot!


From: Brent Salisbury notifications@github.com Sent: Monday, April 8, 2019 4:11 PM To: nerdalert/nflow-generator Cc: Idan; Author Subject: Re: [nerdalert/nflow-generator] Issue with running nflow-generator in go (#5)

Heya! Trying upgrading to Go v1.7+. https://stackoverflow.com/questions/42802278/install-context-package-in-golang

Regarding the binary, just download and give chmod +x status and you are good to go on a Linux host.

Cheers!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/nerdalert/nflow-generator/issues/5#issuecomment-480988335, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHWTaI9CkYQP1IIq53lBOgFE5oSF4Rbdks5ve6JXgaJpZM4cWb-x.