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

Add kafka backend #1

Merged
merged 6 commits into from
Oct 4, 2024
Merged

Add kafka backend #1

merged 6 commits into from
Oct 4, 2024

Conversation

saryani
Copy link
Owner

@saryani saryani commented Oct 2, 2024

This PR will make it possible for osctrl to send the osquery-agent logs to a kafka topic. this means that these logs will no longer be pushed to the database, you need to set kafka as the log backend at init time otherwise it will log into database.

  • added a logger backend to send the agents logs to kafka
  • added required configuration definition to allow setting up a kafka logger
  • updated the docker-compose to allow to run different backends

* added required configuration definition to allow setting up a kafka
logger
* added a logger backend to send the agents logs to kafka
* updated the docker-compose to allow to run different backends
@@ -12,7 +12,7 @@ import (

const (
// DBString to format connection string to database for postgres
DBString = "host=%s port=%s dbname=%s user=%s password=%s sslmode=disable"
DBString = "host=%s port=%s dbname=%s user=%s password=%s sslmode=require"
Copy link
Owner Author

@saryani saryani Oct 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i will revert this line before creating PR against upstream, it's needed for our tests

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm making some changes to make this configurable!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this db change as the author already added them

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh maaaaan!

@saryani saryani merged commit e690601 into main Oct 4, 2024

OSCTRL_TLS_LOGGER=db

LOG_KAFKA_BOOTSTRAP_SERVERS=my-kafka-bootstrap-server

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need be disabled by default for these config and add more comments for it

@@ -54,6 +54,15 @@ services:
- DB_PASS=${POSTGRES_DB_PASSWORD}
#### Redis settings ####
- REDIS_HOST=osctrl-redis
#### Kafka settings ####
- LOG_KAFKA_BOOTSTRAP_SERVERS=${LOG_KAFKA_BOOTSTRAP_SERVERS}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, it should be disabled by default.

"failed to produce message to kafka topic '%s'. details: %s", l.config.Topic, err)
}
if debug {
log.Printf("message with key '%s' was sent to topic '%s' successfully\n%s", key, l.config.Topic, string(data))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think they updated the log for the application, try to merge with the upstream

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

Successfully merging this pull request may close these issues.

2 participants