[fluentd] format json

Cloud 2018. 4. 10. 18:20


아파치나 nginx로그를 fluentd로 전달하고 싶을 때 regex를 사용하는 것보다 format json을 사용하는 것이 좋다.


https://docs.fluentd.org/v0.12/articles/recipe-json-to-elasticsearch



<source>
  @type tail
  path /var/log/httpd-access.log #...or where you placed your Apache access log
  pos_file /var/log/td-agent/httpd-access.log.pos # This is where you record file position
  tag foobar.json #fluentd tag!
  format json # one JSON per line
  time_key time_field # optional; default = time
</source>


Posted by '김용환'
,


마라톤 lb에서 포트별 설정(첫 번째, 두 번째... 등등)을 할 수 있다. 


https://github.com/mesosphere/marathon-lb/blob/master/Longhelp.md


Templates

The following is a list of the available HAProxy templates. Some templates are global-only (such as HAPROXY_HEAD), but most may be overridden on a per service port basis using the HAPROXY_{n}_... syntax.





Labels

HAPROXY_0_MODE=http

HAPROXY_0_VHOST=plus.google.com

HAPROXY_0_SSL_CERT=/etc/ssl/marathon/250.pem



Posted by '김용환'
,



지도를 통한 미세먼지 

https://earth.nullschool.net/#current/chem/surface/level/overlay=cosc/orthographic=-234.88,34.11,1109







일본텐키

http://www.tenki.jp/particulate_matter/ (pc)

http://www.tenki.jp/lite/particulate_matter/  (모바일)






Posted by '김용환'
,


마라톤(marathon)에서 자원 (메모리)가 없으면 다음과 가은 에러가 발생한다. (비슷하게 다른 자원도 해결할 수 있다)


눈으로 볼 때는 메모리 자원 여유는 있지만.. 


앱을 재시작하면서 순간적으로 용량이 부족할 수 있기 때문에, 항상 기존 앱 + 새로 시작할 앱 사이에 2배 공간의 여유가 순간적으로 있을 수 있으니.. 적당하게 공간을 할애하는 것이 좋다. 


 



INFO Offer [c6424609-c06c-463b-91bb-97962d915e56-O374]. Considering resources with roles {googledev, *} without resident reservation labels. Not all basic resources satisfied: cpus SATISFIED (0.1 <= 0.1), mem NOT SATISFIED (256.0 > 176.0) (mesosphere.mesos.ResourceMatcher$:marathon-akka.actor.default-dispatcher-2)



INFO Offer [c6424609-c06c-463b-91bb-97962d915e56-O374]. Insufficient resources for [/plus-stage] (need cpus=0.1, mem=256.0, disk=0.0, gpus=0, ports=(), available in offer: [id { value: "c6424609-c06c-463b-91bb-97962d915e56-O374" } framework_id { value: "3549a1e4-9a61-4bb1-9a0a-8fc66d4e76f4-0000" } slave_id { value: "c6424609-c06c-463b-91bb-97962d915e56-S1" } hostname: "11.11.11.11" resources { name: "cpus" type: SCALAR scalar { value: 7.4 } role: "*" } resources { name: "mem" type: SCALAR scalar { value: 176.0 } role: "*" } resources { name: "disk" type: SCALAR scalar { value: 45240.0 } role: "*" } resources { name: "ports" type: RANGES ranges { range { begin: 31000 end: 31021 } range { begin: 31023 end: 31075 } range { begin: 31077 end: 31136 } range { begin: 31138 end: 31345 } range { begin: 31347 end: 31560 } range { begin: 31562 end: 31856 } range { begin: 31858 end: 32000 } } role: "*" } url { scheme: "http" address { hostname: "10.197.1.63" ip: "10.197.1.63" port: 5051 } path: "/slave(1)" }] (mesosphere.mesos.TaskBuilder$:marathon-akka.actor.default-dispatcher-2)




INFO Finished processing c6424609-c06c-463b-91bb-97962d915e56-O374 from 10.197.1.63. Matched 0 ops after 1 passes. cpus(*) 7.4; mem(*) 176.0; disk(*) 45240.0; ports(*) 31000->31021,31023->31075,31077->31136,31138->31345,31347->31560,31562->31856,31858->32000 left. (mesosphere.marathon.core.matcher.manager.impl.OfferMatcherManagerActor:marathon-akka.actor.default-dispatcher-25)





그러나... 마라톤에서는 계속 Deploying 으로 뜨고 자원도 좀 있었긴 했다...

mesos slave간에 통신으로 mesos에서 저런 에러를 내보낼 수 있다.. 마라톤 하위 버전(1.0.1이었음)이라면 의심해도 좋다.


mesos 슬레이브 에러 로그를 확인하니.. 메소스 통신 중에 문제가 있었고.. 그 여파가 마라톤에서 앱 배포가 문제가 발생했다.


E0409 18:14:34.853005  2198 slave.cpp:3456] Failed to update resources for container 41283b2f-3d3f-40d6-9c37-0011f1dfaa52 of executor 'plus-stage.489512aa-9618-11e7-8450-0242540dd87f' running task plus-stage.489512aa-9618-11e7-8450-0242540dd87f on status update for terminal task, destroying container: Failed to determine cgroup for the 'cpu' subsystem: Failed to read /proc/15390/cgroup: Failed to open file: No such file or directory




문제 해결을 하려면 메소스 버전업을 진행해야 한다. 


Posted by '김용환'
,


테스크 코드를 실행할 때 자바/스칼라 메모리가 부족할 수 있다.


sbt의 경우에는 아래와 같이 사용할 수 있다.


javaOptions ++= Seq("-Xms512M", "-Xmx2048M", "-XX:MaxPermSize=2048M", "-XX:+CMSClassUnloadingEnabled")




메이븐(maven)의 경우는 3가지 방식으로 사용할 수 있다 .(아래 참조)
https://maven.apache.org/configure.html


주로는 다음과 같은 방식을 사용한다.

export MAVEN_OPTS="-Xms512M -Xmx32048M"











Posted by '김용환'
,


페이스북에서 개인정보 이슈로 공격을 받으면서 인스타그램 API의 관련와 관련된 대부분이 deprecated 되었다..



https://instagram.com/developer/changelog/


Platform Changelog

April 4, 2018

The following endpoints are deprecated immediately:

  • Follows and Relationships
    • GET /users/self/follows
    • GET /users/self/followed-by
    • GET /users/self/requested-by
    • GET /users/{user-id}/relationship
    • POST /users/{user-id}/relationship
  • Commenting on Public Content
    • GET /media/{media-id}/comments (Deprecation not relevant when fetching comments for self media)
    • POST /media/{media-id}/comments
    • DEL /media/{media-id}/comments/comment-id
  • Likes
    • GET /media/{media-id}/likes
    • POST /media/{media-id}/likes
    • DEL /media/{media-id}/likes
  • User Search
    • GET /users/{user-id}
    • GET /users/{user-id}/media/recent
    • GET /users/self/media/liked
    • GET /users/search
  • Subscriptions - to receive notifications when media is posted
  • Some information on Public Content returned through hashtag and location search will be removed - Name, Bio, Comments, Commenters, Follower Count, Following Count, Post Count, and Profile Picture


Posted by '김용환'
,


spring boot에서 DB 접속할 때 hikari cp로 연결해서 사용할 수 있다.


JdbcTemplate.query로 DB 연결 후 실행하기 전에 boot가 초기화할 때부터 DB에 붙고 싶다면.

spring.datasource.initializer의 값을 true로 설정한다.

spring.datasource.initialize=true
spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.hikari.jdbc-url=jdbc:oracle:thin:@1.1.1.1:1521:oradb
spring.datasource.hikari.username=username
spring.datasource.hikari.password=pssword
spring.datasource.hikari.connection-timeout=10000
spring.datasource.hikari.validation-timeout=10000


Posted by '김용환'
,
레디 플레이어 원은 어른 피터팬의 동심(?)을 위한 영화이고 보고 즐거웠다. 




좋은 대사


어떤 이들은 톨스토이의 전쟁과 평화를 읽고 단순한 모험 이야기라고 생각하며, 다른 어떤 이들은 껌종이에 쓰인 성분표를 읽고 우주의 비밀을 풀 수 있다.





책도 있는지는 처음 알았다.


(번역본)

http://www.yes24.com/24/goods/17619290?scode=032&OzSrank=1


(원본)

https://www.amazon.com/Ready-Player-One-Ernest-Cline/dp/0307887448


'영화를 보고' 카테고리의 다른 글

"아름다운 것들은 관심을 바라지 않지"  (0) 2018.11.21
[더스토리] 영화의 기억나는 대사  (0) 2018.06.26
칠드런 오브 맨  (0) 2016.10.25
[마이크롭 앤 가솔린]  (0) 2016.07.02
주먹왕 랄프  (0) 2016.03.18
Posted by '김용환'
,



ORA-00933: SQL 명령어가 올바르게 종료되지 않았습니다



보통 이 에러가 발생하면 SQL 문법 에러이다. SQL 툴에서 잘 동작하는지 확인하고.


아니면, 세미콜론(;)이 뒤에 붙어 있는지 확인하면 좋다.

Posted by '김용환'
,

리눅스에서 사용되는 sort와 MacOS의 sort 옵션이 조금 다르다.


따라서 리눅스의 sort 유틸을 사용하고 싶다면. 다음 coreutils 패키지를 설치한다.


[~] brew install coreutils




리눅스에서는 잘된 커맨드가 안먹을 때.. 


[~] du -ss Downloads/*  | sort -h

sort: invalid option -- h

Try `sort --help' for more information.




gsort를 사용하면 원하는 sort 기능을 사용할 수 있다.


[~] du -ss Downloads/*  | gsort -h

0 Downloads/2

1 Downloads/Melon




[~] gsort

3

2

1

asdfsaf

^D


1

2

3

asdfsaf

Posted by '김용환'
,