참조 테이블의 생성
...
Create Lookup Table
The lookup table can be updated and is used to add data that is not in the original log data through a join. The following example shows an example of creating a log table and a lookup table.
Code Block |
---|
-- 로그Create 테이블의log 생성table. create table weblog (addr ipv4, msg varchar(100)); -- 샘플Input 데이터sample 입력data. insert into weblog values ('127.0.0.1', 'a test msessage'); -- 참조Create 테이블의lookup 생성table. create lookup table dnslookup (addr ipv4 primary key, hostname varchar (100)); |
...
Let's insert or update the data in the lookup table.
Code Block |
---|
insert into dnslookup values ('127.0.0.1', 'localhost') on duplicate key update set hostname = '127.0.0.1' |
...
You can retrieve data from lookup tables and log tables through join.
Code Block |
---|
select msg, hostname from weblog, dnslookup where weblog.addr = dnslookup.addr; |
...