Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run this? #26

Open
ghost opened this issue Jun 25, 2024 · 2 comments
Open

How to run this? #26

ghost opened this issue Jun 25, 2024 · 2 comments

Comments

@ghost
Copy link

ghost commented Jun 25, 2024

I would really like to try this out!

I've initiated a new project - go mod init, pasted the "simple app" code in a main.go file and changed the Groups value to match my Log Group.
I do have a working AWS Shell Environment, as I can run aws s3 ls and I get correct data.
When I run "go run main.go" nothing happens, I don't get any output either.

Can you please give me a bit more newb-friendly instructions?
Thank you!

@SteveOfficerSeccl
Copy link

It might be that your AWS defaullt profile is not properly configured.
You can follow the instructions here to see how it should be configured: https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html

Additionally, the sample code just returns on error.
In order to see what errors are occurring you can change

if err != nil {
    return
}

to

if err != nil {
    fmt.Println(err)
    return
}

@vcschapp
Copy link
Collaborator

Thanks @ghost for the query and @SteveOfficerSeccl for providing some tips.

@ghost, in addition to the change suggested by @SteveOfficerSeccl, you may need to make at least one other code change to produce output in your case. The following code is taken verbatim from the "A simple app" code in the README.md. Changing the log group probably won't be quite enough to provide input in most cases because there's also a | filter clause that is looking for messages that contain the text "foo"...

// Query the results.
s, err := m.Query(incite.QuerySpec{
	Text:   "fields @timestamp, @message | filter @message =~ /foo/ | sort @timestamp desc",
	Start:  start,
	End:    end,
	Groups: []string{"/my/log/group"},
	Limit:  100,
})

If you want to just verify that the simple sample app is pulling your logs by having it generate some output, I strongly suggest both dropping the | filter clause (delete the whole text | filter @message =~ /foo/ and following @SteveOfficerSeccl's advice to put in more appropriate error handling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants