{"id":205,"date":"2015-06-08T13:27:26","date_gmt":"2015-06-08T04:27:26","guid":{"rendered":"http:\/\/clouds.tokyo\/blog\/?p=205"},"modified":"2017-02-28T17:36:09","modified_gmt":"2017-02-28T08:36:09","slug":"php_log_origin","status":"publish","type":"post","link":"https:\/\/clouds.tokyo\/blog\/php_log_origin\/","title":{"rendered":"\u3010PHP\u3011\u72ec\u81ea\u306e\u30ed\u30b0\u3092\u51fa\u529b\u3057\u3088\u3046"},"content":{"rendered":"<p>\u958b\u767a\u306b\u30c7\u30d0\u30c3\u30b0\u30ed\u30b0\u3001\u30a8\u30e9\u30fc\u30ed\u30b0\u306f\u6b20\u304b\u305b\u307e\u305b\u3093\u304c\u3001<br \/>\n\u6a19\u6e96\u30ed\u30b0\u3084\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306e\u30ed\u30b0\u3060\u3051\u3067\u306f\u60c5\u5831\u304c\u4e0d\u8db3\u3057\u3066\u3044\u305f\u308a\u3001\u9006\u306b\u60c5\u5831\u304c\u591a\u3059\u304e\u3066\u898b\u306b\u304f\u304b\u3063\u305f\u308a\u3059\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u305b\u3093\u304b\uff1f<br \/>\n\u79c1\u306f\u72ec\u81ea\u306b\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre>\r\nfunction log($val, $cap = null, $json_encode = true) {\r\n  $caption = '';\r\n  if($cap != null) {\r\n    $caption = $cap . ' : ';\r\n  }\r\n\r\n  if($json_encode == true) {\r\n    $val = json_encode(str_replace(\"\\n\", '', $val));\r\n  }\r\n\r\n  $f = fopen('\/tmp\/php_original.log', 'a'); \/* \u30d5\u30a1\u30a4\u30eb\u540d\u306f\u9069\u5b9c\u5909\u66f4\u3057\u3066\u304f\u3060\u3055\u3044 *\/\r\n  @fwrite($f, \"\\n\" . $caption . $val . \"\\n\");\r\n  fclose($f);\r\n}<\/pre>\n<p>\u914d\u5217\u3001\u9023\u60f3\u914d\u5217\u304c\u898b\u3084\u3059\u304f\u51fa\u529b\u3067\u304d\u308b\u306e\u3067JSON\u30a8\u30f3\u30b3\u30fc\u30c9\u3092\u3057\u3066\u51fa\u529b\u3059\u308b\u306e\u304c\u6c17\u306b\u5165\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u4f7f\u3044\u65b9\u306f<\/p>\n<pre>\r\nlog('\u51fa\u529b\u5185\u5bb9', '\u30ad\u30e3\u30d7\u30b7\u30e7\u30f3', JSON\u30a8\u30f3\u30b3\u30fc\u30c9\u306e\u6709\u7121);\r\n<\/pre>\n<p>\u3067\u30ed\u30b0\u51fa\u529b\u3057\u3001<br \/>\n\u3053\u306e\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u3092tail -f\u3067\u51fa\u529b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u958b\u767a\u306b\u30c7\u30d0\u30c3\u30b0\u30ed\u30b0\u3001\u30a8\u30e9\u30fc\u30ed\u30b0\u306f\u6b20\u304b\u305b\u307e\u305b\u3093\u304c\u3001 \u6a19\u6e96\u30ed\u30b0\u3084\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306e\u30ed\u30b0\u3060\u3051\u3067\u306f\u60c5\u5831\u304c\u4e0d\u8db3\u3057\u3066\u3044\u305f\u308a\u3001\u9006\u306b\u60c5\u5831\u304c\u591a\u3059\u304e\u3066\u898b\u306b\u304f\u304b\u3063\u305f\u308a\u3059\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u305b\u3093\u304b\uff1f \u79c1\u306f\u72ec\u81ea\u306b\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002 f &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/clouds.tokyo\/blog\/php_log_origin\/\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;\u3010PHP\u3011\u72ec\u81ea\u306e\u30ed\u30b0\u3092\u51fa\u529b\u3057\u3088\u3046&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_jetpack_newsletter_access":""},"categories":[2],"tags":[96,64,65],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pezW3u-3j","jetpack-related-posts":[{"id":530,"url":"https:\/\/clouds.tokyo\/blog\/linux_syslog\/","url_meta":{"origin":205,"position":0},"title":"\u3010Linux\u3011\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u3092\u3044\u3058\u3063\u305f\u3089\u30ed\u30b0\u304c\u51fa\u529b\u3055\u308c\u306a\u304f\u306a\u3063\u305f","author":"yamamoto","date":"2008\u5e746\u670827\u65e5","format":false,"excerpt":"Apache\u306e\u30ed\u30b0\u3001\u307e\u305f\u306fsendmail\u306e\u30ed\u30b0\u3092\u624b\u3067\u7de8\u96c6\u3057\u305f\u308a\u3059\u308b\u3068 \u305d\u308c\u4ee5\u964d\u30ed\u30b0\u304c\u51fa\u529b\u3055\u308c\u306a\u304f\u306a\u2026","rel":"","context":"\u5099\u5fd8\u9332","block_context":{"text":"\u5099\u5fd8\u9332","link":"https:\/\/clouds.tokyo\/blog\/category\/memo\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1674,"url":"https:\/\/clouds.tokyo\/blog\/event_log_explorer\/","url_meta":{"origin":205,"position":1},"title":"\u30a4\u30d9\u30f3\u30c8\u30ed\u30b0\u3092\u89e3\u6790\u3059\u308b\u305f\u3081\u306e\u30c4\u30fc\u30eb\u300cEvent Log Explorer\u300d","author":"yamamoto","date":"2024\u5e745\u670820\u65e5","format":false,"excerpt":"Active Direcotry\u306e\u30b0\u30eb\u30fc\u30d7\u30dd\u30ea\u30b7\u30fc\u8a2d\u5b9a\u306e\u300c\u30d5\u30a1\u30a4\u30eb\u30b7\u30b9\u30c6\u30e0\u76e3\u67fb\u300d\u3092\u5229\u7528\u3057\u3066\u3001 \u30a4\u30d9\u30f3\u2026","rel":"","context":"\u5099\u5fd8\u9332","block_context":{"text":"\u5099\u5fd8\u9332","link":"https:\/\/clouds.tokyo\/blog\/category\/memo\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1672,"url":"https:\/\/clouds.tokyo\/blog\/ad_access_log\/","url_meta":{"origin":205,"position":2},"title":"\u3010Active Directory\u3011\u30b0\u30eb\u30fc\u30d7\u30dd\u30ea\u30b7\u30fc\u3067\u5171\u6709\u30d5\u30a9\u30eb\u30c0\u306e\u30a2\u30af\u30bb\u30b9\u30ed\u30b0\u3092\u53d6\u308b","author":"yamamoto","date":"2024\u5e744\u670823\u65e5","format":false,"excerpt":"Active Direcotry\u306e\u30b0\u30eb\u30fc\u30d7\u30dd\u30ea\u30b7\u30fc\u8a2d\u5b9a\u306e\u300c\u30d5\u30a1\u30a4\u30eb\u30b7\u30b9\u30c6\u30e0\u76e3\u67fb\u300d\u3092\u5229\u7528\u3057\u3066\u3001 \u30a4\u30d9\u30f3\u2026","rel":"","context":"\u5099\u5fd8\u9332","block_context":{"text":"\u5099\u5fd8\u9332","link":"https:\/\/clouds.tokyo\/blog\/category\/memo\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":431,"url":"https:\/\/clouds.tokyo\/blog\/aws_ec2_s3\/","url_meta":{"origin":205,"position":3},"title":"\u3010AWS\u3011EC2\u304b\u3089S3\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u53d6\u5f97\u3057\u3066\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3055\u305b\u308b(PHP)","author":"yamamoto","date":"2016\u5e746\u670811\u65e5","format":false,"excerpt":"\u307e\u305a\u306fSDK\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002 Releases \u00b7 aws\/aws-sdk-php \u00b7 Git\u2026","rel":"","context":"\u5099\u5fd8\u9332","block_context":{"text":"\u5099\u5fd8\u9332","link":"https:\/\/clouds.tokyo\/blog\/category\/memo\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":223,"url":"https:\/\/clouds.tokyo\/blog\/php_sendmail\/","url_meta":{"origin":205,"position":4},"title":"\u3010PHP\u3011\u30b7\u30f3\u30d7\u30eb\u306b\u30e1\u30fc\u30eb\u9001\u4fe1","author":"yamamoto","date":"2010\u5e742\u670826\u65e5","format":false,"excerpt":"\u30b7\u30f3\u30d7\u30eb\u306a\u65e5\u672c\u8a9e\u30e1\u30fc\u30eb\u9001\u4fe1\u30af\u30e9\u30b9\u3067\u3059\u3002\u30b5\u30fc\u30d0\u30fc\u306e\u6587\u5b57\u30b3\u30fc\u30c9\u306fUTF-8\u3068\u3057\u305f\u5834\u5408\u3002 class ma\u2026","rel":"","context":"\u5099\u5fd8\u9332","block_context":{"text":"\u5099\u5fd8\u9332","link":"https:\/\/clouds.tokyo\/blog\/category\/memo\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1461,"url":"https:\/\/clouds.tokyo\/blog\/win-event-log\/","url_meta":{"origin":205,"position":5},"title":"Windows\u306e\u30a4\u30d9\u30f3\u30c8\u30ed\u30b0\u3092\u62bd\u51fa\u3059\u308b","author":"yamamoto","date":"2021\u5e7410\u670829\u65e5","format":false,"excerpt":"\u30c6\u30ec\u30ef\u30fc\u30af\u306e\u793e\u54e1\u304c\u5897\u3048\u3066\u304f\u308b\u3068\u3001\u4eba\u4e8b\u3084\u7d4c\u55b6\u9663\u3068\u3057\u3066\u306f \u3061\u3083\u3093\u3068\u793e\u54e1\u304c\u4ed5\u4e8b\u3092\u3057\u3066\u3044\u308b\u304b\u30c1\u30a7\u30c3\u30af\u3057\u305f\u304f\u306a\u2026","rel":"","context":"\u5099\u5fd8\u9332","block_context":{"text":"\u5099\u5fd8\u9332","link":"https:\/\/clouds.tokyo\/blog\/category\/memo\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/clouds.tokyo\/blog\/wp-json\/wp\/v2\/posts\/205"}],"collection":[{"href":"https:\/\/clouds.tokyo\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/clouds.tokyo\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/clouds.tokyo\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/clouds.tokyo\/blog\/wp-json\/wp\/v2\/comments?post=205"}],"version-history":[{"count":1,"href":"https:\/\/clouds.tokyo\/blog\/wp-json\/wp\/v2\/posts\/205\/revisions"}],"predecessor-version":[{"id":206,"href":"https:\/\/clouds.tokyo\/blog\/wp-json\/wp\/v2\/posts\/205\/revisions\/206"}],"wp:attachment":[{"href":"https:\/\/clouds.tokyo\/blog\/wp-json\/wp\/v2\/media?parent=205"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/clouds.tokyo\/blog\/wp-json\/wp\/v2\/categories?post=205"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/clouds.tokyo\/blog\/wp-json\/wp\/v2\/tags?post=205"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}