$npx -y skills add grandcamel/Splunk-Assistant-Skills --skill splunk-exportHigh-volume streaming data extraction for Splunk.
| 1 | # splunk-export |
| 2 | |
| 3 | High-volume streaming data extraction for Splunk. |
| 4 | |
| 5 | ## Purpose |
| 6 | |
| 7 | Export large result sets (>50,000 rows) efficiently using streaming. |
| 8 | |
| 9 | ## Risk Levels |
| 10 | |
| 11 | | Operation | Risk | Notes | |
| 12 | |-----------|------|-------| |
| 13 | | Export results | - | Read-only | |
| 14 | | Export from job | - | Read-only | |
| 15 | | Estimate size | - | Read-only | |
| 16 | |
| 17 | ## Triggers |
| 18 | |
| 19 | - "export", "download", "extract" |
| 20 | - "stream", "large results", "ETL" |
| 21 | - "backup", "archive" |
| 22 | |
| 23 | ## CLI Commands |
| 24 | |
| 25 | | Command | Description | |
| 26 | |---------|-------------| |
| 27 | | `export estimate` | Estimate export size | |
| 28 | | `export job` | Export from existing job | |
| 29 | | `export results` | Export results to file | |
| 30 | | `export stream` | Stream large exports efficiently | |
| 31 | |
| 32 | ## Options |
| 33 | |
| 34 | | Option | Commands | Description | |
| 35 | |--------|----------|-------------| |
| 36 | | `-o`, `--output-file` | job, results, stream | Output file path (required) | |
| 37 | | `-f`, `--format` | job, results, stream | Export format (csv, json, json_rows, xml) | |
| 38 | | `-e`, `--earliest` | estimate, results, stream | Earliest time | |
| 39 | | `-l`, `--latest` | estimate, results, stream | Latest time | |
| 40 | | `-c`, `--count` | job, stream | Maximum results to export | |
| 41 | | `--fields` | results, stream | Comma-separated fields to export | |
| 42 | | `--progress` | results | Show progress | |
| 43 | |
| 44 | ## Examples |
| 45 | |
| 46 | ### Export Results |
| 47 | |
| 48 | ```bash |
| 49 | # Export to CSV (using short flags) |
| 50 | splunk-as export results "index=main | head 1000" -o results.csv |
| 51 | |
| 52 | # Export to JSON with specific fields |
| 53 | splunk-as export results "index=main" -o data.json -f json --fields host,status |
| 54 | |
| 55 | # Export with progress indicator |
| 56 | splunk-as export results "index=main | stats count by host" -o report.csv --progress |
| 57 | ``` |
| 58 | |
| 59 | ### Export from Existing Job |
| 60 | |
| 61 | ```bash |
| 62 | # Export results from a completed search job |
| 63 | splunk-as export job 1703779200.12345 -o job_results.csv |
| 64 | |
| 65 | # Export with count limit |
| 66 | splunk-as export job 1703779200.12345 -o results.csv -c 10000 |
| 67 | |
| 68 | # Export as JSON array (json_rows format) |
| 69 | splunk-as export job 1703779200.12345 -o data.json -f json_rows |
| 70 | ``` |
| 71 | |
| 72 | ### Stream Export |
| 73 | |
| 74 | ```bash |
| 75 | # Stream large export efficiently |
| 76 | splunk-as export stream "index=main | head 1000000" -o large_results.csv |
| 77 | |
| 78 | # Stream with count limit |
| 79 | splunk-as export stream "index=main" -o results.csv -c 50000 |
| 80 | |
| 81 | # Stream with specific fields |
| 82 | splunk-as export stream "index=main" -o data.json -f json_rows --fields host,status |
| 83 | ``` |
| 84 | |
| 85 | ### Estimate Size |
| 86 | |
| 87 | ```bash |
| 88 | # Preview count before export |
| 89 | splunk-as export estimate "index=main | stats count by host" -e -7d |
| 90 | # Output: Estimated 1,234,567 results |
| 91 | ``` |
| 92 | |
| 93 | ## API Endpoints |
| 94 | |
| 95 | | Endpoint | Description | |
| 96 | |----------|-------------| |
| 97 | | `GET /services/search/v2/jobs/{sid}/results` | Stream results | |
| 98 | | `GET /services/search/v2/jobs/{sid}/events` | Stream raw events | |
| 99 | |
| 100 | ## Parameters |
| 101 | |
| 102 | | Parameter | Description | |
| 103 | |-----------|-------------| |
| 104 | | `count=0` | Return all results (no limit) | |
| 105 | | `output_mode` | csv, json, xml, raw | |
| 106 | | `field_list` | Comma-separated fields | |
| 107 | |
| 108 | ## Best Practices |
| 109 | |
| 110 | 1. **Use streaming** for >50K results |
| 111 | 2. **Estimate size first** before large exports |
| 112 | 3. **Limit fields** to reduce data transfer |
| 113 | 4. **Monitor progress** for long-running exports |
| 114 | 5. **Compress output** for storage efficiency |
| 115 | |
| 116 | ## Related Skills |
| 117 | |
| 118 | - [splunk-search](../splunk-search/SKILL.md) - Query execution |
| 119 | - [splunk-job](../splunk-job/SKILL.md) - Job management |