Debian Codegraph @

ansible_collections/splunk/es/plugins/modules/splunk_investigation_info.py

raw
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3
4 # Copyright 2026 Red Hat Inc.
5 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
6
7
8 DOCUMENTATION = """
9 ---
10 module: splunk_investigation_info
11 short_description: Gather information about Splunk Enterprise Security Investigations
12 description:
13 - This module allows for querying information about Splunk Enterprise Security Investigations.
14 - Use this module to retrieve investigation configurations without making changes.
15 - Query by C(investigation_ref_id) to fetch a specific investigation.
16 - Query by C(name) to filter investigations by exact name match.
17 - Use C(create_time_min) and C(create_time_max) to control the time range of returned investigations.
18 version_added: "5.1.0"
19 options:
20 investigation_ref_id:
21 description:
22 - Reference ID (investigation ID) to query a specific investigation.
23 - If specified, returns only the investigation with this ID.
24 - Takes precedence over C(name) if both are provided.
25 required: false
26 type: str
27 name:
28 description:
29 - Name to filter investigations.
30 - Returns all investigations with an exact name match.
31 - Ignored if C(investigation_ref_id) is provided.
32 - The C(create_time_min) and C(create_time_max) time filters still apply when querying by name.
33 required: false
34 type: str
35 create_time_min:
36 description:
37 - The minimum time during which investigations were created.
38 - All investigations returned have a creation time greater than or equal to this value.
39 - Accepts relative time (e.g. C(-30m), C(-7d), C(-1w)), epoch time, or ISO 8601 time.
40 - If not provided, no minimum time filter is applied.
41 required: false
42 type: str
43 create_time_max:
44 description:
45 - The maximum time during which investigations were created.
46 - All investigations returned have a creation time less than or equal to this value.
47 - Accepts relative time (e.g. C(-30m), C(now)), epoch time, or ISO 8601 time.
48 - If not provided, no maximum time filter is applied.
49 required: false
50 type: str
51 limit:
52 description:
53 - Maximum number of investigations to return.
54 - If not specified, all matching investigations are returned.
55 - Use this to limit large result sets.
56 required: false
57 type: int
58 api_namespace:
59 description:
60 - The namespace portion of the Splunk API path.
61 - Override this if your environment uses a different namespace.
62 type: str
63 default: servicesNS
64 api_user:
65 description:
66 - The user portion of the Splunk API path.
67 - Override this if your environment requires a different user context.
68 type: str
69 default: nobody
70 api_app:
71 description:
72 - The app portion of the Splunk API path for the investigations endpoint.
73 - Override this if your environment uses a different app name.
74 type: str
75 default: missioncontrol
76
77 author: Ron Gershburg (@rgershbu)
78 """
79
80 EXAMPLES = """
81 - name: Query specific investigation by ref_id
82 splunk.es.splunk_investigation_info:
83 investigation_ref_id: "abc-123-def-456"
84 register: result
85
86 - name: Display the investigation info
87 debug:
88 var: result.investigations
89
90 - name: Query investigations by name
91 splunk.es.splunk_investigation_info:
92 name: "Security Incident 2026-01"
93 register: result
94
95 - name: Query investigations by name within a time range
96 splunk.es.splunk_investigation_info:
97 name: "Security Incident 2026-01"
98 create_time_min: "-7d"
99 create_time_max: "now"
100 register: result
101
102 - name: Display investigations with matching name
103 debug:
104 var: result.investigations
105
106 - name: Query all investigations
107 splunk.es.splunk_investigation_info:
108 register: all_investigations
109
110 - name: Display all investigations
111 debug:
112 var: all_investigations.investigations
113
114 - name: Query investigations created in the last 7 days
115 splunk.es.splunk_investigation_info:
116 create_time_min: "-7d"
117 register: recent_investigations
118
119 - name: Query investigations created in the last 30 days
120 splunk.es.splunk_investigation_info:
121 create_time_min: "-30d"
122 register: all_investigations
123
124 - name: Query investigations with a limit on results
125 splunk.es.splunk_investigation_info:
126 create_time_min: "-7d"
127 limit: 50
128 register: limited_investigations
129
130 - name: Query investigations from a specific time range (ISO 8601)
131 splunk.es.splunk_investigation_info:
132 create_time_min: "2026-01-01T00:00:00"
133 create_time_max: "2026-01-07T23:59:59"
134 register: all_investigations
135
136 - name: Query investigations from a specific time range (epoch)
137 splunk.es.splunk_investigation_info:
138 create_time_min: "1676497520"
139 create_time_max: "1676583920"
140 register: all_investigations
141
142 # Query investigations with custom API path (for non-standard environments)
143 - name: Query investigations with custom API path
144 splunk.es.splunk_investigation_info:
145 create_time_min: "-7d"
146 api_namespace: "{{ es_namespace | default('servicesNS') }}"
147 api_user: "{{ es_user | default('nobody') }}"
148 api_app: "{{ es_app | default('missioncontrol') }}"
149 register: custom_investigations
150 """
151
152 RETURN = """
153 investigations:
154 description: List of investigations matching the query
155 returned: always
156 type: list
157 elements: dict
158 contains:
159 investigation_ref_id:
160 description: The unique reference ID of the investigation
161 type: str
162 name:
163 description: Name of the investigation
164 type: str
165 description:
166 description: Description of the investigation
167 type: str
168 status:
169 description: Status of the investigation
170 type: str
171 disposition:
172 description: Disposition of the investigation
173 type: str
174 owner:
175 description: Owner of the investigation
176 type: str
177 urgency:
178 description: Urgency level of the investigation
179 type: str
180 sensitivity:
181 description: Sensitivity level of the investigation
182 type: str
183 finding_ids:
184 description: List of finding IDs attached to the investigation
185 type: list
186 elements: str
187 sample:
188 - investigation_ref_id: "abc-123-def-456"
189 name: "Security Incident 2026-01"
190 description: "Investigation into suspicious login activity"
191 status: "new"
192 disposition: "undetermined"
193 owner: "admin"
194 urgency: "high"
195 sensitivity: "amber"
196 finding_ids:
197 - "A265ED94-AE9E-428C-91D2-64BB956EB7CB@@notable@@62eaebb8c0dd2574fc0b3503a9586cd9"
198 """