|
8 | 8 | content: Enable Logpush to Splunk |
9 | 9 | --- |
10 | 10 |
|
11 | | -import { Render, APIRequest } from "~/components"; |
| 11 | +import { Render, APIRequest, Tabs, TabItem, DashButton } from "~/components"; |
12 | 12 |
|
13 | 13 | The [HTTP Event Collector (HEC)](https://dev.splunk.com/enterprise/docs/devtools/httpeventcollector/) is a reliable method to receive data from Splunk Enterprise or Splunk Cloud Platform. Cloudflare Logpush supports pushing logs directly to Splunk HEC via the Cloudflare dashboard or API. |
14 | 14 |
|
@@ -177,31 +177,66 @@ Refer to the [Logpush FAQ](/logs/faq/logpush/) for troubleshooting information. |
177 | 177 |
|
178 | 178 | ### 3. Create WAF custom rule for Splunk HEC endpoint (optional) |
179 | 179 |
|
180 | | -If your logpush destination hostname is proxied through Cloudflare, and you have the Cloudflare Web Application Firewall (WAF) turned on, you may be challenged or blocked when Cloudflare makes a request to Splunk HTTP Event Collector (HEC). To make sure this does not happen, you have to create a WAF custom rule that allows Cloudflare to bypass the HEC endpoint. |
| 180 | +If your logpush destination hostname is proxied through Cloudflare, and you have the Cloudflare Web Application Firewall (WAF) turned on, you may be challenged or blocked when Cloudflare makes a request to Splunk HTTP Event Collector (HEC). To make sure this does not happen, you have to create a [custom rule](/waf/custom-rules/) that allows Cloudflare to bypass the HEC endpoint. |
| 181 | + |
| 182 | +<Tabs syncKey="dashNewNav"> <TabItem label="Old dashboard"> |
181 | 183 |
|
182 | 184 | 1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/) and select your account. Go to **Security** > **WAF** > **Custom rules**. |
183 | 185 | 2. Select **Create rule** and enter a descriptive name for it (for example, `Splunk`). |
184 | 186 | 3. Under **When incoming requests match**, use the **Field**, **Operator**, and **Value** dropdowns to create a rule. After finishing each row, select **And** to create the next row of rules. Refer to the table below for the values you should input: |
185 | 187 |
|
186 | | -| Field | Operator | Value | |
187 | | -| ---------------- | ---------- | --------------------------------------------------------------------- | |
188 | | -| Request Method | `equals` | `POST` | |
189 | | -| Hostname | `equals` | Your Splunk endpoint hostname. For example: `splunk.cf-analytics.com` | |
190 | | -| URI Path | `equals` | `/services/collector/raw` | |
191 | | -| URI Query String | `contains` | `channel` | |
192 | | -| AS Num | `equals` | `132892` | |
193 | | -| User Agent | `equals` | `Go-http-client/2.0` | |
| 188 | + | Field | Operator | Value | |
| 189 | + | ---------------- | ---------- | --------------------------------------------------------------------- | |
| 190 | + | Request Method | `equals` | `POST` | |
| 191 | + | Hostname | `equals` | Your Splunk endpoint hostname. For example: `splunk.cf-analytics.com` | |
| 192 | + | URI Path | `equals` | `/services/collector/raw` | |
| 193 | + | URI Query String | `contains` | `channel` | |
| 194 | + | AS Num | `equals` | `132892` | |
| 195 | + | User Agent | `equals` | `Go-http-client/2.0` | |
194 | 196 |
|
195 | 197 | 4. After inputting the values as shown in the table, you should have an Expression Preview with the values you added for your specific rule. The example below reflects the hostname `splunk.cf-analytics.com`. |
196 | 198 |
|
197 | | -```txt |
198 | | -(http.request.method eq "POST" and http.host eq "splunk.cf-analytics.com" and http.request.uri.path eq "/services/collector/raw" and http.request.uri.query contains "channel" and ip.src.asnum eq 132892 and http.user_agent eq "Go-http-client/2.0") |
199 | | -``` |
| 199 | + ```txt |
| 200 | + (http.request.method eq "POST" and http.host eq "splunk.cf-analytics.com" and http.request.uri.path eq "/services/collector/raw" and http.request.uri.query contains "channel" and ip.src.asnum eq 132892 and http.user_agent eq "Go-http-client/2.0") |
| 201 | + ``` |
200 | 202 |
|
201 | 203 | 5. Under the **Then** > **Choose an action** dropdown, select _Skip_. |
202 | 204 | 6. Under **WAF components to skip**, select _All managed rules_. |
203 | 205 | 7. Select **Deploy**. |
204 | 206 |
|
| 207 | +</TabItem> <TabItem label="New dashboard" icon="rocket"> |
| 208 | + |
| 209 | +1. In the Cloudflare dashboard, go to the **Security rules** page. |
| 210 | + |
| 211 | + <DashButton url="/?to=/:account/:zone/security/security-rules" /> |
| 212 | + |
| 213 | +2. Select **Create rule** > **Custom rules**. |
| 214 | + |
| 215 | +3. Enter a descriptive name for the rule (for example, `Splunk`). |
| 216 | + |
| 217 | +4. Under **When incoming requests match**, use the **Field**, **Operator**, and **Value** dropdowns to create a rule. After finishing each row, select **And** to create the next row of rules. Refer to the table below for the values you should input: |
| 218 | + |
| 219 | + | Field | Operator | Value | |
| 220 | + | ---------------- | ---------- | --------------------------------------------------------------------- | |
| 221 | + | Request Method | `equals` | `POST` | |
| 222 | + | Hostname | `equals` | Your Splunk endpoint hostname. For example: `splunk.cf-analytics.com` | |
| 223 | + | URI Path | `equals` | `/services/collector/raw` | |
| 224 | + | URI Query String | `contains` | `channel` | |
| 225 | + | AS Num | `equals` | `132892` | |
| 226 | + | User Agent | `equals` | `Go-http-client/2.0` | |
| 227 | + |
| 228 | +5. After inputting the values as shown in the table, you should have an Expression Preview with the values you added for your specific rule. The example below reflects the hostname `splunk.cf-analytics.com`. |
| 229 | + |
| 230 | + ```txt |
| 231 | + (http.request.method eq "POST" and http.host eq "splunk.cf-analytics.com" and http.request.uri.path eq "/services/collector/raw" and http.request.uri.query contains "channel" and ip.src.asnum eq 132892 and http.user_agent eq "Go-http-client/2.0") |
| 232 | + ``` |
| 233 | + |
| 234 | +6. Under the **Then** > **Choose an action** dropdown, select _Skip_. |
| 235 | +7. Under **WAF components to skip**, select _All managed rules_. |
| 236 | +8. Select **Deploy**. |
| 237 | + |
| 238 | +</TabItem> </Tabs> |
| 239 | + |
205 | 240 | The WAF should now ignore requests made to Splunk HEC by Cloudflare. |
206 | 241 |
|
207 | 242 | :::note |
|
0 commit comments