aboutsummaryrefslogtreecommitdiffstats
path: root/db/postgres/security_rss_keyword.sql
diff options
context:
space:
mode:
authorterminaldweller <devi@terminaldweller.com>2023-07-13 18:10:26 +0000
committerterminaldweller <devi@terminaldweller.com>2023-07-13 18:10:26 +0000
commitb595ac2150e42a22e92b954188ae374d290b3f53 (patch)
treeb5e9d5e421c6d266e669476e2a1dfa4e89383953 /db/postgres/security_rss_keyword.sql
parentupdate (diff)
downloadscripts-main.tar.gz
scripts-main.zip
updateHEADmain
Diffstat (limited to 'db/postgres/security_rss_keyword.sql')
-rw-r--r--db/postgres/security_rss_keyword.sql24
1 files changed, 24 insertions, 0 deletions
diff --git a/db/postgres/security_rss_keyword.sql b/db/postgres/security_rss_keyword.sql
new file mode 100644
index 0000000..6026246
--- /dev/null
+++ b/db/postgres/security_rss_keyword.sql
@@ -0,0 +1,24 @@
+create table if not exists security_rss_keyword_store (
+ id serial primary key not null,
+ logdate timestamp without time zone default now(),
+ nick varchar(128) not null,
+ log varchar(1024) not null,
+ channel varchar(256) not null
+);
+
+create or replace function security_rss_trigger_function()
+returns trigger
+language plpgsql
+as $$
+begin
+ if NEW.log like any(array['%nvidia%','%intel%','%dell%']) then
+ insert into security_rss_keyword_store(nick,log,channel)
+ values (NEW.nick,NEW.log,NEW.channel);
+end;
+$$
+
+create or replace trigger security_rss_trigger
+after insert or update
+on public.logs
+for each row
+execute function security_rss_trigger_function();