|
| 1 | +# Integration with AWS EC2 |
| 2 | +This guide provides step-by-step instructions to integrate AWS EC2 with OpenObserve. |
| 3 | + |
| 4 | + |
| 5 | +## Overview |
| 6 | +Stream system metrics and logs from EC2 Linux instances to OpenObserve using the OpenObserve Collector (based on OpenTelemetry). |
| 7 | + |
| 8 | + |
| 9 | +## Steps to Integrate |
| 10 | + |
| 11 | + |
| 12 | +??? "Prerequisites" |
| 13 | + - OpenObserve account ([Cloud](https://cloud.openobserve.ai/web/) or [Self-Hosted](../../../quickstart/#self-hosted-installation)) |
| 14 | + - AWS EC2 Linux instance with SSH access |
| 15 | + |
| 16 | + |
| 17 | +??? "Step 1: Connect to EC2 Instance" |
| 18 | + |
| 19 | + ```bash |
| 20 | + chmod 400 "your-key.pem" |
| 21 | + ssh -i /path/to/your-key.pem ec2-user@your-instance-public-dns |
| 22 | + ``` |
| 23 | + |
| 24 | + |
| 25 | +??? "Step 2: Install OpenObserve Collector" |
| 26 | + |
| 27 | + |
| 28 | + 1. In OpenObserve: Data Sources → Linux → Copy curl command |
| 29 | + 2. Execute the command on your EC2 instance. |
| 30 | + |
| 31 | + |
| 32 | +  |
| 33 | + |
| 34 | + |
| 35 | +??? "Step 3: Configure the OpenTelemetry Collector" |
| 36 | + |
| 37 | + |
| 38 | + The OpenObserve Collector is pre-configured during installation, but you can customize it for your specific needs. |
| 39 | + |
| 40 | + |
| 41 | + 1. View the current configuration: |
| 42 | + ```bash |
| 43 | + sudo nano /etc/otel-collector/config.yaml |
| 44 | + ``` |
| 45 | + 2. To include additional log files, modify the `filelog` receiver: |
| 46 | + ```yaml |
| 47 | + filelog: |
| 48 | + include: ["/var/log/*.log", "/path/to/your/custom/app.log"] |
| 49 | + ``` |
| 50 | + 3. Restart the collector: |
| 51 | + ```bash |
| 52 | + sudo systemctl restart otel-collector |
| 53 | + ``` |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | +??? "Step 4: Generate Test Data (Optional)" |
| 59 | + |
| 60 | + |
| 61 | + Run `stress-ng` or `logger` to create test metrics and logs if needed: |
| 62 | + ```bash |
| 63 | + stress-ng --cpu 2 --timeout 60s |
| 64 | + logger "Test log message" |
| 65 | + ``` |
| 66 | + |
| 67 | + |
| 68 | +??? "Step 5: Verify Ingestion" |
| 69 | + |
| 70 | + |
| 71 | + **Logs**: |
| 72 | + |
| 73 | + Go to **Logs** in Openobserve → select **stream** → set **time range** → **Run Query** to check for EC2 logs. |
| 74 | + |
| 75 | + |
| 76 | +  |
| 77 | + |
| 78 | + |
| 79 | + **Metrics** |
| 80 | + |
| 81 | + |
| 82 | + Go to **Metrics** in Openobserve → select **stream** → set **time range** → **Run Query** to check for EC2 metrics. |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | + |
| 87 | +??? "Troubleshooting" |
| 88 | + |
| 89 | + |
| 90 | + **Otel Misconfiguration Issues** |
| 91 | + |
| 92 | + |
| 93 | + - If you're not seeing logs or metrics in OpenObserve, check the collector logs for errors: |
| 94 | + |
| 95 | + |
| 96 | + ```bash |
| 97 | + sudo journalctl -u otel-collector -f | grep Error |
| 98 | + ``` |
| 99 | + |
| 100 | + |
| 101 | + - Look for issues such as misconfigurations, permission problems, or connectivity errors. |
| 102 | + |
| 103 | + |
| 104 | + **File Permission Issues** |
| 105 | + |
| 106 | + |
| 107 | + The collector may encounter "permission denied" errors when trying to access specific system logs: |
| 108 | + |
| 109 | + |
| 110 | + - Check the permissions of the log files: `sudo ls -l /var/log/` |
| 111 | + - If you see permission issues, update the permissions: |
| 112 | + ```bash |
| 113 | + # Adjust permissions for specific log files |
| 114 | + sudo chmod 644 /var/log/cloud-init.log /var/log/cloud-init-output.log /var/log/tallylog |
| 115 | + ``` |
| 116 | + |
| 117 | + |
| 118 | + **Restart the Collector Service** |
| 119 | + |
| 120 | + |
| 121 | + - After making configuration changes or adjusting file permissions, restart the collector: `sudo systemctl restart otel-collector` |
| 122 | + - Verify that the collector is running without issues: `sudo systemctl status otel-collector` |
| 123 | + |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | + **No Data Appearing in OpenObserve** |
| 128 | + |
| 129 | + |
| 130 | + - Verify that the OpenObserve endpoint and authentication token are correct in the configuration file. |
| 131 | + - Check that the EC2 instance has internet connectivity to reach the OpenObserve API. |
| 132 | + - Ensure the collector service is running and not reporting any errors in the logs. |
| 133 | + - Verify that the log files specified in the configuration exist and are readable by the collector. |
0 commit comments