Whether you are just starting your observability journey or already are an expert, our courses will help advance your knowledge and practical skills.
Expert insight, best practices and information on everything related to Observability issues, trends and solutions.
Explore our guides on a broad range of observability related topics.
Terraform simplifies the way we deploy our infrastructure and allows us to maintain it as code.
Using our Terraform Modules, you can easily install and manage Coralogix integrations with GCP services as modules in your infrastructure code.
Our modules are open source and available on our GitHub and in the Terraform Registry.
This module will be installing our function app that gets messages from your Pub/Sub topic and sends logs to Coralogix.
For more information about the Function itself, dynamic applicationName and subsystemName and multiline support visit our Pub/Sub guide.
To use the module, first, add the provider configure block to your Terraform project:
terraform { required_providers { google = { source = "hashicorp/google" version = ">= 4.31.0" } } } provider "google" { project = "your-project-id" region = "your-region" }
Then simply add this declaration to your Terraform project:
module "pubsub" { source = "coralogix/google/coralogix//modules/pubsub" coralogix_region = "Europe" private_key = "2f55c873-c0cf-4523-82d4-c3b68ee6cb46" application_name = "Pub/Sub" subsystem_name = "logs" topic = "test-topic-name" }
Important variables to change:
When configuring a GCP logs router sink to catch logs from different resources andthem send to a pub/sub topic be sure to EXCLUDE the function created above from the sink.
NOTE- not following the next step will result in an infinite loop in your GCP function, RESULTING IN HIGH GCP COST; please proceed with caution.
resource "google_logging_project_sink" "logs-sink" { name = "logs-sink" destination = "pubsub.googleapis.com/projects/<my-project-name>/topics/<my-pubsub-topic-name>" exclusions { name = "pub-sub-func" description = "Exclude logs from the coralogix pub-sub function" filter = "resource.labels.function_name=\"${module.pubsub.function}\"" } unique_writer_identity = true }
Note: replace <my-project-name> and <my-pubsub-topic-name> with your relevant values.
Documentation | Coralogix Terraform Provider |
Need help?
Our world-class customer success team is available 24/7 to walk you through your setup and answer any questions that may come up.
Feel free to reach out to us via our in-app chat or by sending us an email at support@coralogix.com.