Xcode 8 에서 쓸모없는 로그 출력안하게 하기

Xcode 8을 설치하고 시뮬레이터에서 앱을 실행하면 이전과 달리 엄청난 로그들을 만나게 됩니다. 대략 아래와 같은 로그들이죠…

2016-09-20 18:43:53.720846 daangna[49804:209191] [] nw_endpoint_flow_attach_protocols [6.1 31.13.68.12:443 in_progress socket-flow (satisfied)] Attached flow protocol
2016-09-20 18:43:53.720996 daangna[49804:209191] [] nw_endpoint_resolver_receive_report [6 graph.facebook.com:443 in_progress resolver (satisfied)] received child report:[6.1 31.13.68.12:443 in_progress socket-flow (satisfied)]
2016-09-20 18:43:53.721119 daangna[49804:209191] [] nw_connection_endpoint_report [6.1 31.13.68.12:443 in_progress socket-flow (satisfied)] reported event flow:start_connect
2016-09-20 18:43:53.725114 daangna[49804:209191] [] nw_socket_handle_socket_event Event mask: 0x800
2016-09-20 18:43:53.725334 daangna[49804:209191] [] nw_socket_handle_socket_event Socket received CONNECTED event
2016-09-20 18:43:53.725523 daangna[49804:209191] [] nw_socket_setup_notsent_lowat Set TCP_NOTSENT_LOWAT(16384)
2016-09-20 18:43:53.725712 daangna[49804:209191] [] nw_endpoint_flow_protocol_connected [6.1 31.13.68.12:443 in_progress socket-flow (satisfied)] Output protocol connected
2016-09-20 18:43:53.726224 daangna[49804:209191] [] nw_endpoint_flow_connected_path_change [6.1 31.13.68.12:443 ready socket-flow (satisfied)]
2016-09-20 18:43:53.726454 daangna[49804:209191] [] nw_endpoint_flow_connected_path_change [6.1 31.13.68.12:443 ready socket-flow (satisfied)] Connected path is satisfied
2016-09-20 18:43:53.726645 daangna[49804:209191] [] nw_endpoint_resolver_receive_report [6 graph.facebook.com:443 in_progress resolver (satisfied)] received child report:[6.1 31.13.68.12:443 ready socket-flow (satisfied)]
2016-09-20 18:43:53.726839 daangna[49804:209191] [] nw_connection_endpoint_report [6.1 31.13.68.12:443 ready socket-flow (satisfied)] reported event flow:finish_connect
2016-09-20 18:43:53.727092 daangna[49804:209191] [] nw_connection_endpoint_report [6 graph.facebook.com:443 ready resolver (satisfied)] reported event flow:finish_connect
2016-09-20 18:43:53.727326 daangna[49804:209191] [] nw_endpoint_resolver_receive_report [6 graph.facebook.com:443 ready resolver (satisfied)] received child report:[6.1 31.13.68.12:443 ready socket-flow (satisfied)]
2016-09-20 18:43:53.727563 daangna[49804:209191] [] nw_connection_endpoint_report [6.1 31.13.68.12:443 ready socket-flow (satisfied)] reported event flow:changed_viability
2016-09-20 18:43:53.727758 daangna[49804:209191] [] nw_connection_endpoint_report [6 graph.facebook.com:443 ready resolver (satisfied)] reported event flow:changed_viability
2016-09-20 18:43:53.728074 daangna[49804:209175] [] __tcp_connection_start_block_invoke 6 sending event TCP_CONNECTION_EVENT_CONNECTED in response to state ready and error (null)
2016-09-20 18:43:53.728255 daangna[49804:209175] [] tcp_connection_event_notify 6 event: TCP_CONNECTION_EVENT_CONNECTED, reason: nw_connection event, should deliver: true
2016-09-20 18:43:53.728673 daangna[49804:209175] [] nw_endpoint_start_tls_while_connected [6.1 31.13.68.12:443 ready socket-flow (satisfied)]
2016-09-20 18:43:53.728852 daangna[49804:209175] [] nw_endpoint_start_tls_while_connected [6.1 31.13.68.12:443 ready socket-flow (satisfied)] Using CoreTLS
2016-09-20 18:43:53.729044 daangna[49804:209175] [] nw_endpoint_start_tls_while_connected [6.1 31.13.68.12:443 ready socket-flow (satisfied)] Set custom TLS client queue
2016-09-20 18:43:53.729243 daangna[49804:209175] [] nw_endpoint_start_tls_while_connected [6.1 31.13.68.12:443 ready socket-flow (satisfied)] Set custom TLS prepare handler
2016-09-20 18:43:53.729432 daangna[49804:209175] [] nw_endpoint_start_tls_while_connected [6.1 31.13.68.12:443 ready socket-flow (satisfied)] Set custom TLS message handler
2016-09-20 18:43:53.729621 daangna[49804:209175] [] nw_endpoint_start_tls_while_connected [6.1 31.13.68.12:443 ready socket-flow (satisfied)] Attached TLS protocol to connected flow
2016-09-20 18:43:53.729784 daangna[49804:209175] [] nw_endpoint_resolver_receive_report [6 graph.facebook.com:443 ready resolver (satisfied)] received child report:[6.1 31.13.68.12:443 in_progress socket-flow (satisfied)]
2016-09-20 18:43:53.730001 daangna[49804:209175] [] nw_connection_endpoint_report [6.1 31.13.68.12:443 in_progress socket-flow (satisfied)] reported event flow:start_secondary_connect
2016-09-20 18:43:53.730186 daangna[49804:209175] [] nw_connection_endpoint_report [6 graph.facebook.com:443 in_progress resolver (satisfied)] reported event flow:start_secondary_connect
2016-09-20 18:43:53.730400 daangna[49804:209175] [] nw_endpoint_resolver_receive_report [6 graph.facebook.com:443 in_progress resolver (satisfied)] received child report:[6.1 31.13.68.12:443 in_progress socket-flow (satisfied)]
2016-09-20 18:43:53.730580 daangna[49804:209175] [] nw_connection_endpoint_report [6.1 31.13.68.12:443 in_progress socket-flow (satisfied)] reported event flow:start_connect
2016-09-20 18:43:53.730777 daangna[49804:209175] [] nw_connection_endpoint_report [6 graph.facebook.com:443 in_progress resolver (satisfied)] reported event flow:start_connect
2016-09-20 18:43:53.730938 daangna[49804:209175] [] nw_endpoint_flow_protocol_connected [6.1 31.13.68.12:443 in_progress socket-flow (satisfied)] Transport protocol connected
2016-09-20 18:43:53.731079 daangna[49804:209175] [] nw_endpoint_resolver_receive_report [6 graph.facebook.com:443 in_progress resolver (satisfied)] received child report:[6.1 31.13.68.12:443 in_progress socket-flow (satisfied)]
2016-09-20 18:43:53.731277 daangna[49804:209175] [] nw_connection_endpoint_report [6.1 31.13.68.12:443 in_progress socket-flow (satisfied)] reported event flow:finish_transport
2016-09-20 18:43:53.731424 daangna[49804:209175] [] nw_connection_endpoint_report [6 graph.facebook.com:443 in_progress resolver (satisfied)] reported event flow:finish_transport
2016-09-20 18:43:53.746985 daangna[49804:209191] [] nw_endpoint_flow_protocol_connected [6.1 31.13.68.12:443 in_progress socket-flow (satisfied)] Output protocol connected
2016-09-20 18:43:53.747630 daangna[49804:209191] [] nw_endpoint_flow_connected_path_change [6.1 31.13.68.12:443 ready socket-flow (satisfied)]
2016-09-20 18:43:53.747850 daangna[49804:209191] [] nw_endpoint_flow_connected_path_change [6.1 31.13.68.12:443 ready socket-flow (satisfied)] Connected path is satisfied
2016-09-20 18:43:53.748068 daangna[49804:209191] [] nw_endpoint_resolver_receive_report [6 graph.facebook.com:443 in_progress resolver (satisfied)] received child report:[6.1 31.13.68.12:443 ready socket-flow (satisfied)]
2016-09-20 18:43:53.748310 daangna[49804:209191] [] nw_connection_endpoint_report [6.1 31.13.68.12:443 ready socket-flow (satisfied)] reported event flow:finish_connect
2016-09-20 18:43:53.748607 daangna[49804:209191] [] nw_connection_endpoint_report [6 graph.facebook.com:443 ready resolver (satisfied)] reported event flow:finish_connect
2016-09-20 18:43:53.748830 daangna[49804:209175] [] __tcp_connection_start_block_invoke 6 sending event TCP_CONNECTION_EVENT_TLS_HANDSHAKE_COMPLETE in response to state ready and error (null)
2016-09-20 18:43:53.749050 daangna[49804:209175] [] tcp_connection_event_notify 6 event: TCP_CONNECTION_EVENT_TLS_HANDSHAKE_COMPLETE, reason: nw_connection event, should deliver: true
2016-09-20 18:43:53.749295 daangna[49804:209175] [] tcp_connection_get_statistics DNS: 3ms/4ms since start, TCP: 10ms/17ms since start, TLS: 18ms/34ms since start
2016-09-20 18:44:07.686676 daangna[49804:209118] subsystem: com.apple.UIKit, category: Touch, enable_level: 0, persist_level: 0, default_ttl: 1, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
2016-09-20 18:44:07.687387 daangna[49804:209118] subsystem: com.apple.UIKit, category: Gesture, enable_level: 0, persist_level: 0, default_ttl: 1, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
2016-09-20 18:44:07.688917 daangna[49804:209118] subsystem: com.apple.UIKit, category: GestureExclusion, enable_level: 0, persist_level: 0, default_ttl: 1, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
2016-09-20 18:44:58.968517 daangna[49804:209882] [] nw_socket_handle_socket_event Event mask: 0x2
2016-09-20 18:44:58.968960 daangna[49804:209883] [] tcp_connection_cancel 6
2016-09-20 18:44:58.969395 daangna[49804:209882] [] nw_socket_handle_socket_event Socket received READ_CLOSE event
2016-09-20 18:44:58.969753 daangna[49804:209882] [] nw_endpoint_handler_cancel [6 graph.facebook.com:443 ready resolver (satisfied)]
2016-09-20 18:44:58.970003 daangna[49804:209882] [] nw_endpoint_handler_cancel [6.1 31.13.68.12:443 ready socket-flow (satisfied)]
2016-09-20 18:44:58.970305 daangna[49804:209882] [] nw_endpoint_flow_protocol_disconnected [6.1 31.13.68.12:443 cancelled socket-flow (null)] Output protocol disconnected
2016-09-20 18:44:58.970517 daangna[49804:209882] [] nw_resolver_cancel_on_queue 0x618000103210
2016-09-20 18:44:58.970791 daangna[49804:209882] [] -[NWConcrete_tcp_connection dealloc] 6

이 로그들을 없애려면 “Edit Scheme” 에서 “Run” > “Arguments” > “Environment Variables” 에 다음과 같은 값을 추가해야합니다.

Name 에는 OS_ACTIVITY_MODE 를 추가하고 Value 에는 disable 을 입력후 왼쪽 체크박스를 체크한 상태로 둡니다.

Xcode 8 log fix
Xcode 8 log fix

이 현상은 애플이 의도적으로 넣은건지 아닌지 모르겠지만 꽤나 귀찮습니다.

참고자료

게시글의 아마존, iTunes 링크들을 통해 구매를 하시면 제휴(Affiliate) 프로그램에 의해 저에게 일정 금액이 적립될 수 있습니다. ^_____^

kibana 혹은 elasicsearch 에서 unique count 정확하게 보기

사용자 pv 확인을 위해 kibana를 사용중이었는데 kibana의 unique 갯수와 kibana와 동일한 쿼리로 추출하는 일일 접속자의 id 목록의 갯수와 맞지 않는 현상이 발생했다.

es에서 갯수를 계산할때 대략적인 수치를 사용한다는것을 알고는 있었지만 대략 5000 vs 4500 정도로 오류의 편차가 너무 커서 이를 해결하고자 방법을 찾던중 실마리를 찾았다.

unique 갯수를 추출하기 위해 cardinality aggregation을 사용하는데 이 수치에는 어느정도의 에러 수치가 있고 이를 해결하기위해서는 precision_threshold 옵션 수치를 수정하면 된다. precision_threshold 수치가 높으면 더 많은 메모리와 자원을 사용하고 속도는 느리지만 정확한 값을 얻을수 있고 낮으면 메모리와 자원도 적게 쓰고 속도도 빠르지만 부정확한 데이터를 얻게 된다.

precision_threshold 값의 기본값이 얼마인지는 모르겠지만 내가 문제 생겼던 서비스의 경우 수치가 10,000 이하이기 때문에 precision_threshold 값을 10,000으로 설정했더니 정확한 데이터를 얻을수 있었다.

kibana에서 precision_threshold 값을 입력하기 위해서는 Y-Axis > Advanced > JSON Input 에 다음과 같이 입력한다.

{"precision_threshold": 10000}

precision_threshold 입력하기

그런데 이값을 적용하고 나면 정말 느려진다 =_= 정확한 수치가 중요한 경우가 아니라면 굳이 입력하지 않고 흐름을 보는데만 확인하고 필요할때만 입력하는게 좋을것 같다.

참고자료

게시글의 아마존, iTunes 링크들을 통해 구매를 하시면 제휴(Affiliate) 프로그램에 의해 저에게 일정 금액이 적립될 수 있습니다. ^_____^

맥에 설치된 도커(Docker) 삭제하기

도커를 맥에서 사용하는 방법으로 Docker Toolbox, Docker for Mac 두가지가 있는데, Docker Toolbox는 생긴지 좀 오래 되었고 Docker for Mac은 좀더 편하게 사용하기 위해 가장 최근에 나온 방법이다.

지금 도커를 맥에서 설치한다면 Docker for Mac을 이용해 설치하는것이 좋은데, 이미 Docker Toolbox로 설치된 도커가 있다면 다음과 같은 방법으로 삭제한다.

터미널을 실행해서 다음 명령어로 삭제 스크립트 파일을 다운로드 받는다.

$ curl -O https://raw.githubusercontent.com/docker/toolbox/master/osx/uninstall.sh

다운로드 받은 파일에 실행 권한을 추가하고 실행하면 도커가 깔끔하게 삭제 된다 ^^

$ chmod +x uninstall.sh
$ ./uninstall.sh

 

게시글의 아마존, iTunes 링크들을 통해 구매를 하시면 제휴(Affiliate) 프로그램에 의해 저에게 일정 금액이 적립될 수 있습니다. ^_____^