> For the complete documentation index, see [llms.txt](https://cocktailcloud.gitbook.io/cocktail-cloud-online-en/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cocktailcloud.gitbook.io/cocktail-cloud-online-en/log-service/installation/install-log-service.md).

# Install Log Service

{% hint style="info" %}
Before installing the log service, 'cert-manager' and 'nginx' require pre-installation.
{% endhint %}

<figure><img src="/files/VSBLsH6izD62cVpjFBst" alt=""><figcaption></figcaption></figure>

## 1. Distribution Addon

1\) Infrastructure - Clusters - Addon List - Click the "Deploy" button and click the "Deploy" button for 'cocktail-log-service' in the list.

<figure><img src="/files/AXCBa3yxsimW4HWoh2Cu" alt=""><figcaption></figcaption></figure>

2\) Check the settings according to your environment and click the Deploy button to deploy the Addon.

<figure><img src="/files/6r8sxviXzooFvXHvkgnu" alt=""><figcaption></figcaption></figure>

**`Gateway Service Mode`** :  Log service gateway type (Ingress, LoadBalancer)

***

\[If Gateway Service Mode is set to Ingress]

**`Gateway Access URL`** :   DNS to access log service through Ingress

**`URL Type`** : Cluster HostAliases type (PublicDNS or HostAliases)

**`Host Ip`** : (If URL Type is 'HostAliases') LB IP (or node IP) that can access the cluster from outside

{% hint style="success" %}
When accessing the log service from the dashboard or collecting logs from log-agent, connect the Host IP to the Log Access URL.
{% endhint %}

**`Enable OpenSearch Dashboard`** : Use or not 'Opensearch Dashboard'

***

\[If Gateway Service Mode is set to LoadBalancer]

<figure><img src="/files/AiEQNzEAF1vydfxVF5RK" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Clusters created through provisioning can only be set to '**Enable OpenSearch Dashboard'**.
{% endhint %}

3\) Check the deployment status and if the status is 'Running', confirm that the deployment has been completed successfully.

<figure><img src="/files/HCFMOXxSdd053BcCqkh0" alt=""><figcaption></figcaption></figure>

**`If the status is 'pending' when deployed`**

{% embed url="<https://cocktailcloud.gitbook.io/cocktail-cloud-online-en/log-service/troubleshooting#install-error>" %}

4\) Create a job in the namespace where the log service is installed.

<figure><img src="/files/EuFvoqtSewxZAmAQ8aOO" alt=""><figcaption></figcaption></figure>

Create a Job that creates policies for each container log, cluster audit log, and application log collected by Opensearch.

<figure><img src="/files/IOPZJR2wH7Goy0rREYxq" alt=""><figcaption></figcaption></figure>

```yaml
apiVersion: batch/v1
kind: Job
metadata:
  name: policy-generate
  namespace: cocktail-logs
spec:
  ttlSecondsAfterFinished: 600
  template:
    spec:
      containers:
        - image: [registry address]/library/cocktail-auto-injector:1.0.0-release.20240425
          imagePullPolicy: Always
          command:
            - /bin/sh
            - -c
            - sh /auto/service/gen.sh -H opensearch-cluster-master.cocktail-logs -c 30d -u 100d -a 30d -m run
          name: gen
      restartPolicy: Never
  backoffLimit: 0
```

**`registry address`** :  Please contact our technical team.

If you create a job according to the settings above, container logs have a storage period of **30 days**, cluster audit logs have a storage period of **56 days**, and application logs have a storage period of **1 year**.

{% hint style="info" %}
Storage period settings can be modified in 'OpenSearch Dashboard'.
{% endhint %}
