본문 바로가기
Engineering/ELK

(스크랩) logstash-output-jdbc ( timestamp value를 INSERT 문에서 CAST 하기 )

by 알탱2 2021. 6. 4.
반응형

스크랩 원본 : https://www.rubydoc.info/gems/logstash-output-jdbc/0.1.4

 

File: README — Documentation for logstash-output-jdbc (0.1.4)

logstash-output-jdbc This plugin is provided as an external plugin and is not part of the Logstash project. This plugin allows you to output to SQL databases, using JDBC adapters. See below for tested adapters, and example configurations. This has not yet

www.rubydoc.info


지인이 logstash를 통해 DB 데이터를 수집하여 postgresql에 넣는 작업을 하던 중, input으로 입수된 날짜 데이터 값을 output 테이블의 `timestamp with time zone` 타입의 컬럼에 넣는 과정에서 아래와 같은 에러 메세지가 출력되는 이슈를 경험하였다.

column "created_at" is of type timestamp without time zone but expression is of type character varying

 

결론적으로 위 포스트를 참고하여 logstash-output-jdbc 에서 timestamp 타입으로 INSERT 시, SQL 마다 CAST 여부의 차이가 있음을 발견하였고, 

Postgres 부분에 해당하는 부분을 참고하여 해결 하였다. 

 

Example : 

반응형

댓글