Skip to content

Commit

Permalink
#170697: Add request uri pattern lua script
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Masteller committed Dec 5, 2023
1 parent fc95170 commit 536f01e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
with_items:
- {src: ./templates/modify_date.lua.j2, name: modify_date.lua}
- {src: ./templates/add_fields.lua.j2, name: add_fields.lua}
- {src: ./templates/add_request_pattern.lua.j2, name: add_request_pattern.lua}
notify: Restart Fluentbit

- name: Create service.d directory
Expand Down
10 changes: 10 additions & 0 deletions templates/add_request_pattern.lua.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- add requestUriPattern based on requestUri
function add_request_pattern(tag, timestamp, record)
if record["requestUri"] ~= nil
then
uri = record["requestUri"]
pattern = uri:gsub("/[^/]*%d+[^/.]*", "/#")
record["requestUriPattern"] = pattern
end
return 1, timestamp, record
end

0 comments on commit 536f01e

Please sign in to comment.