# MrLooquer GCP

## Steps and requirements

Steps to configure and integrate your GCP account with MrLooquer:

1. [Create a Exportation Logs](/integrations/mrlooquer-gcp.md#create-a-exportation-logs)
2. [Create Service account](/integrations/mrlooquer-gcp.md#create-service-account-for-the-function)
3. [Get api key of MrLooquer Rating](/integrations/mrlooquer-gcp.md#get-api-key-of-mrlooquer-rating)
4. [Create function](/integrations/mrlooquer-gcp.md#create-function)

You need to have a MrLooquer account <https://auth.mrlooquer.com/&#x20>;

### Create a Exportation logs

Go to Logging section in Google cloud console.

![](/files/-LfA2NmFb-1t9_CxI1vH)

In the Filter field, click in the down arrow and click on "convert to advanced filter".

![](/files/-LfA2sFQsPXW37be_XFc)

In the input add the next query:

```
resource.type="gce_instance"
jsonPayload.event_subtype:"compute.instances.insert"
jsonPayload.event_type:"GCE_OPERATION_DONE"
```

And click on "Submit Filter".

Now, click on "Create Export" button.

![](/files/-LfAB3ViZOSjafUP5UbS)

In the form:

![](/files/-LfA46S4m1nNAM_MwDMq)

Complete the "Sink name" field with a text of you want. The "Sink Service" select "Cloud Pub/Sub" and in the "Sink Destination" field select "Create new Cloud Pub/Sub topic".

![](/files/-LfA4I-GolCyM9qgKDYS)

In the modal, complete the name field and click on "Create"

And select the topic just created in the "Sink Destination" field.

To complete the creation process, click on "Create Sink" button.

### Create Service account for the function

Go to IAM & admin > Service accounts

![](/files/-LfA51DqP925dLwO4ed_)

Click on "Create Service Account" button, in the top of the page:

![](/files/-LfGu_CUpFQQ7C0oYTfA)

In the first step, complete the fields and click on "Create" button

![](/files/-LfA5k6sENFzl9suVWwg)

In the second step, add 2 roles:

Compute Engine > Compute Viewer

![](/files/-LfA6ZuPCN3hZqidj1wp)

And Compute Engine > Compute Network Viewer

![](/files/-LfA6dmoFInz4xH69i-U)

At the end, the form should be:

![](/files/-LfA6i1VZGU9ay5AklTZ)

Click on "Continue" button, and in the next step, click on "Done".

### Get api key of MrLooquer Rating

Login on [MrLooquer Rating](https://auth.mrlooquer.com/) and go to "Settings" menu. Set a name and copy the token.

![](/files/-Ld3ENjbbdP9_06g2TMx)

### Create function

Go to "Cloud functions"

![](/files/-LfA7ITEQUHuDuj_p93o)

Click on "Create function" button.

Fill the fields with the following information:

* Name: Name that you want
* Memory allocated: 128 MB
* Trigger: Cloud Pub/Sub
* Topic: The topic that you created in the first step
* Source Code: ZIP uploaded
* Runtime: Node.js 10 (Beta)
* Zip File: You can download the zip of the following url: <https://github.com/mrlooquer/mrlooquer-rating-gcp/releases/download/v1.0.0/code-function.zip>
* Stage bucket: You can choose an existing bucket or create a new bucket.&#x20;
* Function to execute: handler

In the advanced options:

* Region: Region that you want
* Timeout: 60
* Service account: The account that you created in the second step.
* And add one environment variable:
  * API\_TOKEN: The token that you created in the third step.

The form should be:

![](/files/-LfA9CIBDKjrfHP0Qtc1)

![](/files/-LfAC_1Xdr1vqj-lJroZ)

Click on "Create" and you are done!


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mrlooquer.com/integrations/mrlooquer-gcp.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
