Skip to content

Commit 790c893

Browse files
committed
Update macros.conf
Added new macros to enable complex searches for field extraction that isn't possible with standard field extractions.
1 parent 20df6c3 commit 790c893

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

github_app_for_splunk/default/macros.conf

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ definition = index=github_collectd
44
iseval = 0
55

66
[github_source]
7-
definition = (index="github" source="ghe_audit_log_monitoring://*") OR (index=ghes source=github_audit)
7+
definition = (index="github" source="ghe_audit_log_monitoring://*") OR (index=ghes source=github_audit) OR (index=gitops source="github:enterprise:audit") OR (index=gh_audit_stream)
88
iseval = 0
99

1010
[github_webhooks]
@@ -14,3 +14,32 @@ iseval = 0
1414
[github_workflow_logs]
1515
definition = index="github_workflow_logs"
1616
iseval = 0
17+
18+
[devops_indexes]
19+
definition = index="github_webhook" OR index="github_webhook2"
20+
iseval = 0
21+
22+
[individual_commits]
23+
definition = | spath commits{} output=commits \
24+
| mvexpand commits \
25+
| rex field=commits "(?<=\"id\"\:\")(?<commit_hash>\w*)"\
26+
| rex field=commits "(?<=\"message\"\:\")(?<commit_message>(\w|\s)*)"\
27+
| rex field=commits "(?<=\"username\"\:\")(?<commit_username>(\w|-)*(?=\"))"\
28+
| rex field=commits "(?<=\"timestamp\"\:\")(?<commit_timestamp>[^\"]*(?=\"))"\
29+
| rex field=commits "(?<=\"added\"\:\[)(?<commit_files_added>[^\]]*(?=\]))"\
30+
| rex field=commits "(?<=\"removed\"\:\[)(?<commit_files_removed>[^\]]*(?=\]))"\
31+
| rex field=commits "(?<=\"modified\"\:\[)(?<commit_files_modified>[^\]]*(?=\]))"
32+
iseval = 0
33+
34+
[extract_branch_issuenumber]
35+
definition = | eval branch = if(('ref_type'=="branch" AND 'ref'!=""), 'ref', "") \
36+
| eval ref = if((isnull('ref') AND isnotnull('pull_request.head.ref') AND ('eventtype'=="GitHub::PullRequest" OR 'eventtype'=="GitHub::PullRequest::Review")), 'pull_request.head.ref', if((isnull('ref') AND isnotnull('pull_request.base.ref') AND ('eventtype'=="GitHub::PullRequest" OR 'eventtype'=="GitHub::PullRequest::Review")), 'pull_request.base.ref', 'ref'))\
37+
| rex field="ref" "(?<commit_branch>(?<=refs\/heads\/).*)" \
38+
| eval commit_branch = if((isnull('commit_branch') AND isnotnull('pull_request.head.ref') AND ('eventtype'=="GitHub::PullRequest" OR 'eventtype'=="GitHub::PullRequest::Review")), 'pull_request.head.ref', if((isnull('commit_branch') AND isnotnull('pull_request.base.ref') AND ('eventtype'=="GitHub::PullRequest" OR 'eventtype'=="GitHub::PullRequest::Review")), 'pull_request.base.ref', if((isnull('commit_branch') AND isnotnull('ref')), 'ref', 'commit_branch')))\
39+
| rex field="commit_branch" "(?<issueNumber>^\d*)"
40+
iseval = 0
41+
42+
[extract_release_push_tags]
43+
definition = | eval ref_tags = if((isnotnull('ref') AND eventtype="GitHub::Release::Push"), ref, null())\
44+
| rex field="ref_tags" "(?<release_tag_name>(?<=refs\/tags\/).*)"
45+
iseval = 0

0 commit comments

Comments
 (0)